// 把写的提示信心需要换行的地方分成数组 confirmText
const confirmText = ['是否将产品001从我的自选中移出?', '是否将产品002从我的自选中移出?']
const newDatas = []
const h = this.$createElement
for (const i in confirmText) {
newDatas.push(h('p', null, confirmText[i]))
}
this.$confirm(
'提示',
{
title: '提示',
message: h('div', null, newDatas),
showCancelButton: true,
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}
).then(() => {
})

本文介绍了一个使用Vue.js创建确认框的示例,通过循环遍历数组生成多个确认消息,展示了如何在Vue中使用$createElement和$confirm方法来构建动态的提示信息。
470

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



