Home > Article > Web Front-end > What should I do if vue jump does not open a new window?
The solution to vue jump without opening a new window: 1. Jump to the corresponding page through "console.log('val.route',val.route)"; 2. Jump to the corresponding page through "this.$router. push(val.route)" directly jumps to the route and displays it in the current window.
The operating environment of this tutorial: Windows10 system, vue3 version, DELL G3 computer
What should I do if vue jumps and does not open a new window? ?
vue How to open a new window when routing jumps?
Key points: this.$router.resolve
window.open(routeOne.href, '_blank')
Such as:
watch:{ //监听页面快捷菜单跳转 如待办任务点击更多 等 routeObj(val){ //切换菜单 this.switchApp(val.code) //跳转对应页面 console.log('val.route',val.route) // 如"/test" setTimeout(()=>{ if(val.tag==1){ // 直接路由跳转,在当前窗口展示 this.$router.push(val.route) }else{ //打开新窗口展示 const routeOne = this.$router.resolve({ path: val.route, }) window.open(routeOne.href, '_blank') } },500) } },
Recommended learning: "vue video tutorial"
The above is the detailed content of What should I do if vue jump does not open a new window?. For more information, please follow other related articles on the PHP Chinese website!