elmentui中自定义notify中的元素

因业务需要,要做一个从右下角弹出的消息提醒,需要自定义元素和样式,其代码如下:

const h = this.$createElement
        this.instance = this.$notify({
          title: '来电提醒',
          message: h('div', null, [
            h('p', null,
              [
                h('img', {
                  attrs: {src: 'https://lcfile.sishuxuefu.com/cc2a754da594590a604f.png'},
                  style: 'vertical-align: center;width: 15px;height: 15px;border-color: #fff;dispaly: inline-block;margin-left:75px;margin-top: 15px;'
                }),
                h('span', customerNum, {
                  style: 'font-size: 16px;margin-left: 10px;dispaly: inline-block;'
                })
              ]),
            h('button', {
              style: 'border-radius: 30px;margin-left: 50px;color: #fff;display: inline-block;width: 65px;height: 25px;background: #409EFF;border: none;font-size: 14px;margin-top: 20px;',
              on: {
                click: this.answer
              }
            }, '接听'),
            h('button', {
              style: 'border-radius: 30px;color: #fff;display: inline-block;width: 65px;height: 25px;background: #FA495F;margin-left: 30px;border: none;font-size: 14px;margin-top: 20px;',
              on: {
                click: this.hangup
              }
            }, '挂断')
          ]),
          position: 'bottom-right',
          duration: 0
        })

h为创建一个元素,将其添加到notify中。可以自定义样式和属性,绑定事件

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值