// 监听路由,每次进入页面调用方法,放在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' },
上一篇:vue截取字符串
下一篇:vue动态设置元素高度
emit传入的事件名称只能使用小写,不能使用大写的驼峰规则命名。
解决办法,加延迟。
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M