ElementUI组件Notification自定义HTML

createElement参考地址:https://www.cnblogs.com/vickylinj/p/9566474.html

methods: {
  notify() {
    this.$notify({
      title: '标题',
      position: 'right-bottom',
      dangerouslyUseHTMLString: true,
      message: this.$createElement(
        'div',
        {},
        [
          this.$createElement('p', {}, [
            this.$createElement('span', { style: { fontWeight: 'bold', color: 'red' } }, '点击触发vue函数:'),
            this.$createElement('a', 
              { 
                class: 'send-elink-btn', 
                on: { click: this.test }  
              }, '点击调用test函数'),
            this.$createElement('a', 
              { 
                class: 'send-elink-btn', 
                on: { click: () => {this.test('222')} }  
              }, '点击调用test函数带参数'),
          ]),
        ]
      ),
    });
  },
  test(txt) {
    console.log(txt)
  }
}

 

Logo

前往低代码交流专区

更多推荐