What should I do if vue jump does not open a new window?

藏色散人
Release: 2023-01-29 13:51:26
Original
2051 people have browsed it

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.

What should I do if vue jump does not open a new 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)    
    }
  },
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template