Can vue-router open a link in a new tab?

后端 未结 11 1720
礼貌的吻别
礼貌的吻别 2020-12-04 16:58

I have a summary page and a detail subpage. All of the routes are implemented with vue-router (v 0.7.x) using programmatic navigation like this:



        
11条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-04 17:52

    Just write this code in your routing file :

    {
      name: 'Google',
      path: '/google',
      beforeEnter() {                    
                    window.open("http://www.google.com", 
                    '_blank');
                }
    }
    

提交回复
热议问题