"element-ui": "^2.4.5"
效果图如下:
如有需要在confirm、notify循环添加数据
// 把写的提示信心需要换行的内容写在数组里 confirmText
const confirmText = [ '1、回到首页后,实验流程数据将会清空。', '2、实验左下角提示按钮中包含实验介绍内容和实验操作引导视频。']
const newDatas = []
const h = this.$createElement
for (const i in confirmText) {
newDatas.push(h('p', null, confirmText[i]))
}
this.$notify({
title: 'HTML 片段',
message: h('div', null, newDatas),
dangerouslyUseHTMLString: true,
// type: 'success'
});
this.$confirm(
'提示',
{
title: '提示',
message: h('div', null, newDatas),
showCancelButton: true,
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
} ).then(() => {
}).catch(() => {
})
如有不对,欢迎指正!