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

二次封装科技风大屏element-ui弹窗

弹窗最终效果

在这里插入图片描述

<template><el-dialog:visible.sync="dialogVisible":close-on-click-modal="false":close-on-press-escape="false":show-close="false":width="width"append-to-bodymodal-append-to-bodycustom-class="screen-dialog"><!-- 装饰性图片 --><img src="~@/assets/img/screen/dialog/border-left.png" class="border-left" alt="" /><img src="~@/assets/img/screen/dialog/border-right.png" class="border-right" alt="" /><img src="~@/assets/img/screen/dialog/border-top.png" class="border-top-left" alt="" /><img src="~@/assets/img/screen/dialog/border-top.png" class="border-top-right" alt="" /><img src="~@/assets/img/screen/dialog/border-bottom.png" class="border-bottom-left" alt="" /><img src="~@/assets/img/screen/dialog/border-bottom.png" class="border-bottom-right" alt="" /><img src="~@/assets/img/screen/dialog/top-left-angle.png" class="top-left-angle" alt="" /><img src="~@/assets/img/screen/dialog/top-right-angle.png" class="top-right-angle" alt="" /><img src="~@/assets/img/screen/dialog/bottom-left-angle.png" class="bottom-left-angle" alt="" /><img src="~@/assets/img/screen/dialog/bottom-right-angle.png" class="bottom-right-angle" alt="" /><img src="~@/assets/img/screen/dialog/top-icon.png" class="top-icon" alt="" /><img src="~@/assets/img/screen/dialog/bottom-icon.png" class="bottom-icon" alt="" /><img src="~@/assets/img/screen/dialog/close.png" class="close-icon" alt="" @click="close" /><!-- 标题区域 --><div class="screen-dialog-head"><div class="title-pnl"><img class="left-img" src="~@/assets/img/screen/dialog/right-arrow.png" alt="" /><div class="title-name">{{ title }}</div><img class="right-img" src="~@/assets/img/screen/dialog/left-arrow.png" alt="" /></div></div><!-- 内容区域 --><div class="screen-dialog-body"><slot></slot></div><!-- 底部区域 --><div class="screen-dialog-footer"><slot name="footer"></slot></div></el-dialog>
</template><script>
export default {name: 'ScreenDialog',props: {title: {type: String,default: '标题'},width: {type: String,default: '1200px'},visible: {type: Boolean,default: false}},data() {return {dialogVisible: this.visible};},watch: {visible(newVal) {this.dialogVisible = newVal;},dialogVisible(newVal) {if (!newVal) {this.$emit('update:visible', false);}}},methods: {close() {this.dialogVisible = false;}}
};
</script><style lang="scss">
.screen-dialog {background: transparent;box-shadow: none;.el-dialog__header {display: none;}.el-dialog__body {background: url("~@/assets/img/screen/dialog/body-bg.png") no-repeat;background-size: 100% 100%;background-origin: content-box;padding: 37px 33px 53px;position: relative;// 左边框.border-left {width: 33px;// 100% - 左上角标高度 - 左下角标高度height: calc(100% - 37px - 53px);position: absolute;left: 0;top: 37px;}// 右边框.border-right {width: 33px;// 100% - 右上角标高度 - 右下角标高度height: calc(100% - 37px - 53px);position: absolute;right: 0;top: 37px;}// 上边框.border-top-left {height: 37px;// 100% - 左上角标宽度 - 右上角标宽度 - 中间图标宽度width: calc((100% - 33px - 33px - 236px) / 2);position: absolute;top: 0;left: 33px;}// 上边框.border-top-right {height: 37px;// 100% - 左上角标宽度 - 右上角标宽度 - 中间图标宽度width: calc((100% - 33px - 33px - 236px) / 2);position: absolute;top: 0;right: 33px;}// 下边框.border-bottom-left {height: 53px;// 100% - 左下角标宽度 - 右下角标宽度 - 中间图标宽度width: calc((100% - 33px - 33px - 166px) / 2);position: absolute;bottom: 0;left: 33px;}// 下边框.border-bottom-right {height: 53px;// 100% - 左下角标宽度 - 右下角标宽度 - 中间图标宽度width: calc((100% - 33px - 33px - 166px) / 2);position: absolute;bottom: 0;right: 33px;}// 左上角标.top-left-angle {width: 33px;height: 37px;position: absolute;top: 0;left: 0;}// 左下角标.bottom-left-angle {width: 33px;height: 53px;position: absolute;bottom: 0;left: 0;}// 右上角标.top-right-angle {width: 33px;height: 37px;position: absolute;top: 0;right: 0;}// 右下角标.bottom-right-angle {width: 33px;height: 53px;position: absolute;bottom: 0;right: 0;}.top-icon {width: 236px;height: 39px;position: absolute;top: -2px;left: 50%;transform: translateX(-50%);}.bottom-icon {width: 166px;height: 51px;position: absolute;bottom: 2px;left: 50%;transform: translateX(-50%);}// 关闭按钮.close-icon {width: 24px;height: 24px;position: absolute;top: 20px;right: 20px;cursor: pointer;z-index: 1;}// 头部标题.screen-dialog-head {.title-pnl {display: flex;justify-content: center;align-items: center;column-gap: 20px;padding: 0px 40px;background: linear-gradient(90deg,rgba(7, 47, 93, 0.2) 0%,rgba(7, 47, 93, 1) 50%,rgba(7, 47, 93, 0.2) 100%);.left-img,.right-img {width: 13px;height: 10px;}.title-name {font-size: 26px;font-family: "you-she-biao-ti-hei";color: #ffffff;height: 40px;line-height: 40px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}}}}.screen-dialog-body {min-height: 400px;}
}
</style>

使用方式

<template><screen-dialog :title="dialogTitle" :visible.sync="dialogVisible"width="800px"><!-- 主体内容 --><div>这里是对话框的内容</div><!-- 底部内容 --><template #footer><el-button @click="dialogVisible = false">取消</el-button><el-button type="primary" @click="handleConfirm">确认</el-button></template></screen-dialog>
</template><script>
import ScreenDialog from '@/components/ScreenDialog.vue';export default {components: {ScreenDialog},data() {return {dialogTitle: '自定义标题',dialogVisible: false};},methods: {handleConfirm() {// 处理确认逻辑this.dialogVisible = false;}}
};
</script>
http://www.dtcms.com/a/406573.html

相关文章:

  • 【JavaScript 性能优化实战】第六篇:性能监控与自动化优化
  • 沃地泰双奖加冕2025农机大奖,以创新科技赋能智慧农业
  • Spring + Spring MVC + MyBatis
  • 酒店 深圳 网站制作如何找外包网站来做
  • 雪碧图动画实例
  • 总结之webpack
  • 义乌市建设局网站河南建设工程信息网官网洛阳至信阳省道
  • 实时云渲染云推流平台配置Redis、MySQL端口,解决中间件端口冲突
  • 网站建设会议记录增城住房和建设局网站
  • shell编程:sed - 流编辑器(6)
  • Kubernetes ConfigMap 深度解析:配置管理的核心实践Kubernetes Secret 深度解析:敏感配置的安全管理实践
  • 如何实现多人协同文档编辑器
  • 备案ip 查询网站wordpress 分类全文
  • 桂林市建设局网站网站建设招聘
  • 5G x 工业应用:探索德承工控机在5G工业应用中所扮演的关键角色
  • 队列+宽搜(BFS)-662.二叉树最大宽度-力扣(LeetCode)
  • 【C++实战㊷】C++ 原型模式实战:从概念到高效应用
  • MCP 安全“体检” | AI 驱动的 MCP 安全扫描系统
  • 股票跟单网站开发长沙网站建设推广服务
  • 谷城网站制作wordpress给用户推送消息
  • (16)ASP.NET Core2.2 通用主机(HostBuilder)
  • .NET Core报错解决【无废话上操作】
  • python+springboot+uniapp基于微信小程序的农村事务管理与交流系统
  • React 进阶优化概念(6 个)——从能写组件到写好组件(下)| 葡萄城技术团队
  • 网站建设后期怎样维护wordpress什么模块
  • 兰州市七里河建设局网站在洪雅网站做企业招聘
  • JDK 简介及核心优点以及各种版本JDK高速下载地址(文末)
  • 妙妙题!!
  • 深圳个性化网站建设公司电话野外美食网站设计欣赏
  • React 基础核心概念(8 个)——从入门到能写业务组件(上)| 葡萄城技术团队