vue 路由跳转方式 路由间跳转、打开新页面
一、路由间跳转
1. query (所传参数在url中显示)
this.$router.push({
// 路由
path:'/xxx',
// 参数
query:{
id:1,
}
})
2.params (所传参数不在url中显示)
this.$router.push({
name:'xxx',
// 参数
params:{
id:1,
}
})
二、路由跳转(打开新页面)
let newpage = this.$router.resolve({
path: '/xxx',
query: {
id: 1,
},
})
window.open(newpage.href, '_blank')

本文详细介绍了Vue.js中两种路由跳转方式:使用`query`和`params`在路由间进行平滑跳转,以及如何利用`$router.resolve`打开新页面。通过`query`传递的参数会显示在URL,而`params`则不会。同时,展示了在新窗口打开页面的实现代码。

4万+

被折叠的 条评论
为什么被折叠?



