当前位置: 首页 > news >正文

element MessageBox 实现底部三个按钮或者更多按钮—开箱即用

效果图: 

思路:

使用 el-dialog组件实现的。开箱即用,可以直接拿我的代码组件直接引入 方便使用

代码:

html代码
<template><el-dialog custom-class="myConfirmation" :visible.sync="dialogVisible" :title="title" width="420px" :before-close="handleClose"><div class="dialog-content"><i style="color: #e6a23c; font-size: 24px !important; margin-left: 1px" :class="iconClass" class="icon"></i><span>{{ message }}</span></div><span slot="footer" class="dialog-footer"><el-button size="small" v-for="(button, index) in buttons" :key="index" :type="button.type" @click="handleButtonClick(button.action)">{{ button.text }}</el-button></span></el-dialog>
</template>
js代码
<script>
export default {props: {title: {type: String,default: "提示",},message: {type: String,required: true,},icon: {type: String,default: "el-icon-warning",},buttons: {type: Array,default: () => [{ text: "取消", type: "default", action: "cancel" },{ text: "确定", type: "primary", action: "confirm" },],},},data() {return {dialogVisible: true,};},computed: {iconClass() {return this.icon;},},methods: {handleClose() {this.$emit("close");},handleButtonClick(action) {this.$emit("action", action);this.dialogVisible = false;},},
};
</script>
css样式代码
<style lang="scss">
.myConfirmation {font-size: 18px;border-radius: 4px;// 修改样式让对话框水平垂直居中position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%);margin: 0 !important;padding-bottom: 10px;.el-dialog__header {padding: 15px 15px 10px !important;}.el-dialog__body {padding: 10px 15px;color: #606266;font-size: 14px;}.el-dialog__footer {padding: 5px 15px 0;}.dialog-content {display: flex;align-items: center;}.icon {font-size: 24px;margin-right: 10px;}
}
</style>
 

http://www.xdnf.cn/news/334531.html

相关文章:

  • Spring Cloud:概述,服务注册和服务发现,多机部署和负载均衡
  • 二本计算机,毕业=失业?
  • 【Rust】结构体
  • 【算法学习】递归、搜索与回溯算法(二)
  • 计算机网络:深入分析三层交换机硬件转发表生成过程
  • 为了摸鱼和吃瓜,我开发了一个网站
  • 酒店客房拖鞋材质款式多样,对顾客入住感受影响大
  • 面试实践AND面经热点题目总结
  • 紫禁城多语言海外投资理财返利源码带前端uniapp纯工程文件
  • C++ Primer (第五版)-第十四章重载运算与类型转换
  • 雷军「去执行化」与小米汽车更名:一场关乎安全与战略的双向奔赴|创客匠人热点评述
  • 软件工程之需求分析涉及的图与工具
  • V 型球阀:多材质多驱动,精准适配复杂严苛工况-耀圣
  • 开源照片管理系统PhotoPrism的容器化部署与远程管理配置
  • 【electron+vue】常见功能之——调用打开/关闭系统软键盘,解决打包后键盘无法关闭问题
  • Inno Setup专业打包指南:从基础到高级应用
  • 没有Mac,我是怎么上传IPA到App Store的?
  • maven如何搭建自己的私服(LINUX版)?
  • 【Linux修炼手册】Linux开发工具的使用(一):yum与vim
  • 网易游戏 Flink 云原生实践
  • OrangePi Zero 3学习笔记(Android篇)3 - 串口
  • Qt实现车载多媒体项目,包含天气、音乐、视频、地图、五子棋功能模块,免费下载源文件!
  • Linux/AndroidOS中进程间的通信线程间的同步 - 消息队列
  • nputop:交互式 Ascend NPU 进程查看器(nvitop昇腾版)
  • 视觉图像处理及多模态融合初探
  • MyBatis(进阶)(xml标签)
  • 代码随想录算法训练营第三十七天-2|动态规划part2
  • [5-2] 对射式红外传感器计次旋转编码器计次 江协科技学习笔记(38个知识点)
  • 服务器数据恢复—Linux操作系统服务器意外断电导致部分文件丢失的数据恢复
  • 力扣刷题Day 41:除自身以外数组的乘积(238)