this.$confirm换行
时间: 2023-09-29 10:03:54 浏览: 208
Vue 解决在element中使用$notify在提示信息中换行问题
5星 · 资源好评率100%
在使用this.$confirm进行换行时,可以使用$createElement来创建多个p标签,并将它们包裹在一个div标签中。例如,可以使用以下代码进行换行:
```
const h = this.$createElement;
this.$confirm('提示', {
title: '提示',
message: h('div', [
h('p', '是否将该账号密码重置为初始密码?'),
h('p', '成功后将密码设为默认密码,默认密码为用户账号')
]),
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
resetPasswords(params).then((res) => {
if (res.code == 200) {
this.$message.success('重置密码成功');
}
});
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消重置密码',
});
});
```
这样可以在确认框中显示多行文本。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [vue this.$confirm中提示的文字换行](https://blog.csdn.net/weixin_45799001/article/details/125086460)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [confirm提示多行内容时换行问题](https://blog.csdn.net/qq_43432057/article/details/116981331)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [js使用小技巧](https://download.csdn.net/download/qq_17486363/7619983)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文