VUE routing method to open a new page

1. The target of the router-link

router-link tag="a" target="_blank" :to="{name:'searchGoods',params:{catId:0},query:{keywords:'mobile phone'}}" Hot Goods/router-link It should be noted that vue1 does not support it.

2.$router.resolve

 let Link = this.$router.resolve({
     path: '/index',
     query: {
         id: 0,
         name: 'two',
     }
})
window.open(Link.href, '_blank')

Usage is similar to $router.push and $router.go

Of course, for relatively simple parameter passing, you can also directly use the a tag to splicing parameters in the url to open a new page and jump.

Guess you like

Origin blog.csdn.net/ferwagrea/article/details/129315047