07 2019 档案
vue-router需要注意的点
摘要:1.在编程式导航中,如果提供了path,params会被忽略;需要提供name,或手写完整的带有参数的path;以下写法可取: const userId = '123'; 1.this.$router.push({name: 'user', params: {userId}}); 2.this.$r 阅读全文
posted @ 2019-07-15 17:25 千年寒冰90 阅读(706) 评论(0) 推荐(0)
activated钩子函数
摘要:activated钩子函数是在组件被激活后的钩子函数,mounted是不保证组件在document中,也就是组件还没有被激活,因此可以理解为activated执行在mounted之后。 在跳转传值时,接收参数的页面中可能获取不到第二次传的值,放在activated中,可以获取到值的变化。 vue2. 阅读全文
posted @ 2019-07-09 10:22 千年寒冰90 阅读(3589) 评论(0) 推荐(0)
关于beforeRouteEnter中的next()
摘要:beforeRouteEnter(to,from, next){ console.log(this) //undefined next(vm => { console.log(vm)}) } 1 if (token) { 2 if (router.options.isAdd) { //判断是否已经添 阅读全文
posted @ 2019-07-01 16:28 千年寒冰90 阅读(4134) 评论(0) 推荐(0)