// 把换行的内容分成数组放入 confirmText 中 const confirmText = [‘第一行’ , ‘第二行’]; const newDatas = []; const h = this. c r e a t e E l e m e n t ; f o r ( c o n s t i i n c o n f i r m T e x t ) n e w D a t a s . p u s h ( h ( ′ p ′ , n u l l , c o n f i r m T e x t [ i ] ) ) ; t h i s . createElement; for (const i in confirmText) { newDatas.push(h('p', null, confirmText[i])); } this. createElement;for(constiinconfirmText)newDatas.push(h(′p′,null,confirmText[i]));this.confirm( ‘提示’, { title: ‘提示’, message: h(‘div’, null, newDatas), showCancelButton: true, // 是否显示取消按钮 distinguishCancelAndClose: true, // 是否将取消(点击取消按钮)与关闭(点击关闭按钮或遮罩层、按下 ESC 键)进行区分 closeOnPressEscape: true, // 是否可通过按下 ESC 键关闭 MessageBox confirmButtonText: ‘确定’, // 确定按钮的文本内容 cancelButtonText: ‘取消’, // 取消按钮的文本内容 type: ‘warning’ // 消息类型,用于显示图标 success / info / warning / error } ).then(() => { }) .catch(() => { })