vue打开到新页面,并传递参数

it2022-05-09  61

打开新页面,有两种方式,

一种是标签式:

<router-link tag="a" target="_blank" :to="{path: '/edit', params: {id: '000'}}">   一种是函数编程式: let routeData = this.$router.resolve({   path:'/edit',   query:{id: '000'} }); window.open(routeData.href, '_blank');   标签式传值有点问题,在新页面中获取不到参数,所以试了下使用函数式,在新页面中使用: this.$route 可以获取到路由中的信息,包括参数。

转载于:https://www.cnblogs.com/wangqiao170/p/11226628.html


最新回复(0)