监听路由,取出路由name做判断。
watch: { // 对路由变化做出判断 '$route' (to, from) { if (to.name === 'PersonInfoDetail') { this.isEdit = true console.log(to.name) } } }
监听路由,取出路由name做判断。
watch: { // 对路由变化做出判断 '$route' (to, from) { if (to.name === 'PersonInfoDetail') { this.isEdit = true console.log(to.name) } } }