<template> <div class="h1">{{name }}</div> </template> <script> export default { name: "Test", data() { return { name : '', } }, created() { }, watch: { '$route': { handler(newVal, oldVal) { this.getview(newVal, oldVal) }, deep: true, immediate: true, } },methods:{ getview(to, from){ this.name = this.$route.query.name } } } </script>