首页 新闻 赞助 找找看

vue 路由参数中 () => {}

0
[待解决问题]

this.$router.push('/index', () => {});
这是什么写法,在项目中this.$router.push('/index');会报警告:
Redirected when going from "/login" to "/index" via a navigation guard.
父组件
this.$refs.child.open(() => {
this.handleRedirect();
})
handleRedirect() {
this.$router.push('/index', () => {}); //this.$router.push('/index');会报警告
}

子组件
open(callback) {
this.callback = callback
}

一些列操作后调用this.callback();

纯海之蓝的主页 纯海之蓝 | 初学一级 | 园豆:132
提问于:2021-07-14 18:13
< >
分享
所有回答(2)
0

就是人家的push有两个参数?第一个是路径,第二个是回调?

顾晓北 | 园豆:10844 (专家六级) | 2021-07-14 20:01
0
this.$router.push({
    path:'/index'
});
ufo233- | 园豆:85 (初学一级) | 2021-07-15 09:49
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册