效果:

思路:
可以考虑采用模板字符串的思路实现
代码:
this.confirm(`您确定要<b style="Color: red">${text}</b>的数据项?<br/>单位名称: ${row.companyName} <br/>属性: ${row.attributeName}`)
.then(() => {
console.log('确定');
})
.catch(() => {
console.log('取消');
})
还可以配置本地图片图标
this.$confirm(`<img src="${require('@/assets/images/newImages/shanchutishi.png')}" alt class="containerleftimg" style="width: 36px; height: 36px; margin-right: 20px;"/>请确认是否删除该稀产品, 此操作不可逆?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
dangerouslyUseHTMLString: true // 关键配置,允许解析HTML
}).then(() => {
this.$message({
type: 'success',
message: '删除成功!'
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
注意这个配置项: dangerouslyUseHTMLString: true // 关键配置,允许解析HTML

被折叠的 条评论
为什么被折叠?



