// 监听路由,每次进入页面调用方法,放在method里 mounted(){ this.getPath() }, methods: { getPath(){ console.log(this.$route.path); if (this.$route.path == '你要进入的路由') { this.init() // 初始化的方法 } } }, watch: { '$route':'getPath' },
// 监听路由,每次进入页面调用方法,放在method里 mounted(){ this.getPath() }, methods: { getPath(){ console.log(this.$route.path); if (this.$route.path == '你要进入的路由') { this.init() // 初始化的方法 } } }, watch: { '$route':'getPath' },
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。