vue中页面的跳转(当前页面的跳转+空页面的跳转)

1、vue中页面的跳转(打开新页面)**
handleEditTab(row, k) {
console.log(row);
const currentURL = window.location.href; // 获取当前地址
let psrs = {
id: row.id,
uid:JSON.parse(localStorage.getItem(‘me’)).id,
};
console.log(psrs);
const url = ${currentURL.replace("/securityPlan", "/table")}/${ row.assembly }?tableParams=${JSON.stringify(psrs)};
window.open(url, “_blank”);
},
2、使用 router-link 元素进行跳转**
Go to Example page
**3、使用 this. r o u t e r . p u s h 方法进行跳转 ∗ ∗ ∗ ∗ ∗ ∗ t h i s . router.push 方法进行跳转****** this. router.push方法进行跳转this.router.push(‘/example’);
**4、使用 this. r o u t e r . r e p l a c e 方法进行跳转 ∗ ∗ t h i s . router.replace 方法进行跳转** this. router.replace方法进行跳转this.router.replace(‘/example’);
设置 name 和 path 可以使得路由的访问更加方便,同时可以提高代码的可读性和可维护性。
// 使用 name 访问路由
this. r o u t e r . p u s h ( n a m e : ′ e x a m p l e ′ ) ; / / 使用 p a t h 访问路由 t h i s . router.push({ name: 'example' }); // 使用 path 访问路由 this. router.push(name:example);//使用path访问路由this.router.push({ path: ‘/example’,query:{} });

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值