日常开发记录-this.$message,this.$prompt,交换弹窗确定和取消按钮的位置,确定在左,取消在右
2024-09-06 03:25:55
代码:
<template>
<el-button type="text" @click="open">点击打开 Message Box</el-button>
</template> <script>
export default {
methods: {
open () {
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
// MessageBox 的自定义类名
customClass: 'btn-cancle-right'
}).then(() => {
this.$message({
type: 'success',
message: '删除成功!'
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
}
}
}
</script>
// 在单页面使用不可以加scoped限制,否则不生效
<style lang="scss">
/* 可以把这个btn-cancle-right类放置到公共的样式文件中,
这样就可以只定义一次,多次重复使用啦 */
.btn-cancle-right {
.el-message-box__btns {
.el-button:nth-child(1) {
float: right;
}
.el-button:nth-child(2) {
margin-right: 10px;
background-color: #2d8cf0;
border-color: #2d8cf0;
}
}
}
</style>
图示:
最新文章
- MSDTC故障排除,DTCTester用法 (二)
- Materialize一款不错的框架(装逼必备,想想一帮渣渣们还在说bootstrap的时候,你用materialize,高端洋气,别人仰望着,同事们鄙视的看着你还能不能愉快的玩耍的时候,那种孤高的感觉!-_-//意淫结束)
- 如何正确地使用Entity Framework Database First
- [转]Net 下采用GET/POST/SOAP方式动态调用WebService C#实现
- iOS 控制单个控制器旋转
- Android设置布局背景为白色的三种方法
- selenium 处理浏览器多窗口
- C++ Prime:decltype类型指示符
- hdu 1078 FatMouse and Cheese_记忆搜索
- Ubuntu文件系统
- python-day18 JS正则,组件BootStrap、EasyUI、JQueryUI1,插件轮播,django
- 国内安装helm
- anaconda4.2.0
- HTML翻转菜单练习
- Eclipse添加JDK,JRE切换
- leecode第五十四题(螺旋矩阵)
- 亚马逊aws 一个实例双网卡-两个弹性ip设置
- .NET中低版本程序调用高版本DLL
- LeetCode 8 有效的括号
- Overcoming Life&#39;s Obstacles - ASC 2017 March 03-04