elementUI的messagebox中自定义html内容执行点击事件-VNode

elementUI的messagebox中内容执行点击事件-VNode

先来看看需求

在这里插入图片描述

此为elementUI的this.$confirm 我们需要在点击 去续费 跳转到续费页面

解决办法

使用VNode 在elementUI官网中也有介绍https://element.eleme.cn/#/zh-CN/component/message-box#zi-ding-yi

	const h = this.$createElement;
    this.$msgbox({
      title: '文件上传',
      message: h('p', undefined, [
        h('span', undefined, '当前空间不足,请先进行扩容后再进行上传! '),
        h('span', { 
          style: 'color: #ff7d38' ,
          on: {
            click: () => {
              this.goToRenew()
            }
          }}, '去续费')
      ]),
      type: 'warning',
      showCancelButton: true,
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      beforeClose: (action, instance, done) => {
        if (action === 'confirm') {
          this.goToRenew()
        } else {
          done();
        }
      }
    }).then(action => {
    });
  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值