vue window.open()传参

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

一种是标签式:

一种是函数编程式:
let routeData = this.$router.resolve({
  path:’/edit’,
  query:{id: ‘000’}
});
window.open(routeData.href, ‘_blank’);

标签式传值有点问题,在新页面中获取不到参数,所以试了下使用函数式,在新页面中使用:
this.$route
可以获取到路由中的信息,包括参数。

猜你喜欢

转载自blog.csdn.net/dzhi1931/article/details/113353383
今日推荐