希望点击查看详情的时候绑定上事件,可是尝试好久一直不管用
使用的vue结合饿了么开发,现在是在一个组件里面使用自定义html,事件到底改怎么绑定啊
代码如下:
open () {
this.$notify({
title: '消息提醒',
iconClass: 'iconfont icon-xiaoxitixing',
customClass: 'customClass',
dangerouslyUseHTMLString: true,
message: `${this.message}
<p>${this.messageSource}</p>
<span @click=${this.openMessage}>查看详情</span>`,
position: 'bottom-right',
duration: 0
})
},
openMessage () {
console.log(123)
}
因为
message
支持Vue.VNode
,你可以直接用VNode
绑定事件。如果想直接用字符串也能解决,单独绑定
dom
点击事件