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:{} });
vue中页面的跳转(当前页面的跳转+空页面的跳转)
最新推荐文章于 2024-06-01 16:31:18 发布