首页 > Web开发 > 详细

vue 监听 路由 meta的变化

时间:2020-07-15 20:12:03      阅读:205      评论:0      收藏:0      [点我收藏+]

------------恢复内容开始------------

 

 

 

1.配置路由

{
path: ‘/hellow‘,
name:"hellow",
component: hellow,
meta:{title:"hellow"}

}

2,在mount里面赋值

mounted(){
   this.title=this.$route.matched;
},

 

3,由于在页面上刷新才可以显示,所一需要watch监听 

watch: {
‘$route.matched‘: function (newVal, oldVal) {
this.title=this.$route.matched;
}
},

 

3.0的监听watch(()=>root.$route,(to,from)=>{

 

state.title=to.matched;

})

 

------------恢复内容结束------------

vue 监听 路由 meta的变化

原文:https://www.cnblogs.com/xzhce/p/13307087.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!