element ui 的Notification 跳转

最近项目中要用到这个,所以练了练,因为文档中并没有过多的介绍,所以整理了一下

项目中推送消息 后跳转 目前找到两种方式(和群友讨论的)

第一种

openMessage(){
const h = this. $createElement;
this. instance= this. $notify({
title: '异常',
message: h( 'a',{
attrs:{ 'href' : 'https://www.baidu.com',}
}, '我是link'),
duration: 0,
})
},
可以直接跳转各种外部连接

第二种  跳转路由、


onClick(){
this. $router. push({ name: 'xxx', params:{ "xxx" :res}}) //你要跳转的路由 还可以传参 当然也可以通过其他方式跳转
},
openMessage(){
const h = this. $createElement;
this. instance= this. $notify({
title: '异常',
message: h( 'a',{
on:{
click: this. onClick
}
}, '我是link'),
duration: 0,
})
},


这只是本人的思考,若有错误,希望指出 ,谢谢

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值