Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.5k views
in Technique[技术] by (71.8m points)

vue中watch监听$route是深度监听么?

vue听过watch直接监听的$route,这个是深度监听么?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

不是,这个是监听路由参数变化,类似于一个简版的导航守卫。
在一定程度上可以当作普通的 watch 属性来看待——虽然 route 本身非常灵活,但是在这里只能看作是对两个字符串 fromto 的监听,从这个角度来看,并不深。
vue-router内部有很复杂的实现机理,监听所反映的变化深度可以是很深的,但这是 $route 自己的实现,只能算深度变化,不能算深度监听。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...