文章目錄
- 前言
- 具體操作
- 總結
前言
elementUI中的 "this.$confirm" 基本用法,"this.$confirm" 調換 "確認"、"取消" 按鈕的位置
具體操作
基本用法
<script>
this.$confirm('這是數據(res.data)', '提示', {confirmButtonText: '確定',cancelButtonText: '取消',cancelButtonClass: 'custom-cancel-button',//添加樣式,將確認與取消按鈕調換位置type: 'warning',//設置彈框類型showCancelButton: false, //是否顯示取消按鈕showClose: false, //是否顯示右上角的xcloseOnClickModal: true, //是否可以點擊空白處關閉彈窗}).then(() => {// this.$message({// type: 'success',// message: '刪除成功!'// });}).catch(() => {// this.$message({// type: 'info',// message: '已取消刪除'// });});
</script><style>
.el-message-box__btns {display: flex;flex-direction: row-reverse;
}
.custom-cancel-button {margin-left: 10px;
}
</style>
將確認與取消進行交換位置,添加css樣式
CSS代碼:
.el-message-box__btns {display: flex;flex-direction: row-reverse;
}
.custom-cancel-button {margin-left: 10px;
}
總結
elementUI中的 "this.$confirm" 基本用法,"this.$confirm" 調換 "確認"、"取消" 按鈕的位置,添加一個類和css代碼