Vue3使用element-plus实现弹窗效果-demo

 使用 


<ShareDialog v-model="isShow" @onChangeDialog="onChangeDialog" />
import ShareDialog from './ShareDialog.vue';
const isShow = ref(false);
const onShowDialog = (show) => {isShow.value = show;
};
const onChangeDialog = (val) => {console.log('onSureClick', val);isShow.value = false;
};

 组件代码

<template><el-dialogv-model="isShow":show-close="false"class="share-dialog-dialog"style="width: 423px;height: 314px;display: flex;flex-direction: column;justify-content: space-between;background-color: #fff !important;"><template #header><div class="dialog-header"><div class="title">带单平台设置</div><imgsrc="@/assets/images/followOrder/close.svg"@click="isShow = false"/></div></template><template #default><div class="dialog-box"><div:class="['icon', { active: Bi.includes('okx') }]"@click="selectBi('okx')"><i class="icon-btn"></i><img class="icon-bi" src="@/assets/images/followOrder/okx-icon.svg" /><span>Okx</span></div><div:class="['icon', { active: Bi.includes('binance') }]"@click="selectBi('binance')"><i class="icon-btn"></i><imgclass="icon-bi"src="@/assets/images/followOrder/binance-icon.svg"/><span>Binance</span></div><div:class="['icon', { active: Bi.includes('bitget') }]"@click="selectBi('bitget')"><i class="icon-btn"></i><imgclass="icon-bi"src="@/assets/images/followOrder/bitget-icon.svg"/><span>Bitget</span></div></div></template><template #footer><div class="dialog-footer"><div class="false" @click="isShow = false">取消</div><div class="true" @click="onSureClick">确定</div></div></template></el-dialog>
</template><script setup>
import { defineProps, defineEmits, ref, reactive } from 'vue';
const props = defineProps({modelValue: {type: Boolean,default: false}
});const Bi = reactive([]);
const selectBi = (val) => {console.log(val, 888);const i = Bi.indexOf(val);if (i <= -1) {Bi.push(val);} else {Bi.splice(i, 1);}console.log(Bi, 88);
};
const emits = defineEmits(['update:modelValue', 'onChangeDialog']);
const isShow = computed({get() {return props.modelValue;},set(val) {emits('update:modelValue', val);}
});const onSureClick = (val) => {emits('onChangeDialog', true);
};
</script><style lang="less">
.el-dialog__header {margin-right: 0;
}
</style>
<style lang="less" scoped>
.share-dialog-dialog {.dialog-header {display: flex;justify-content: space-between;align-items: center;border-bottom: 1px solid #f1f1f1;padding-bottom: 14px;.title {color: #000;font-size: 20px;font-style: normal;font-weight: 600;line-height: normal;}img {width: 14.161px;height: 14.515px;cursor: pointer;}}.dialog-box {padding: 0 25px;display: flex;justify-content: space-between;align-items: center;.icon {position: relative;display: flex;flex-direction: column;align-items: center;justify-content: center;width: 110px;height: 110px;border-radius: 4px;border: 1px solid #f1f1f1;background: #fff;.icon-btn {position: absolute;top: 5px;right: 5px;width: 15px;height: 15px;background-image: url(@/assets/images/followOrder/quan-icon.svg);background-size: contain;background-repeat: no-repeat;}.icon-bi {width: 40px;height: 40px;margin-bottom: 8px;}& > span {color: #000;font-size: 16px;font-family: PingFang SC;font-style: normal;font-weight: 500;line-height: normal;}}.active {border: 1px solid #31daff;background: #f1fdff;.icon-btn {background-image: url(@/assets/images/followOrder/gou-icon.svg);}}}.dialog-footer {display: flex;align-items: center;justify-content: space-between;color: #000;.false {padding: 10px 75px;border: 1px solid #000000;border-radius: 4px;cursor: pointer;}.true {padding: 10px 75px;background: #31daff;// background: linear-gradient(266.54deg, #f1fb6f 0%, #7cf9cd 98.94%);border-radius: 4px;cursor: pointer;}}
}
</style>

基础代码 

<template><ElDialog:append-to-body="true"destroy-on-close:show-close="false"v-model="isShow"class="application-dialog"><div class="application-dialog-container"><h1>111111</h1></div></ElDialog>
</template><script setup>
import { ElDialog, ElButton } from 'element-plus';
import { defineProps, defineEmits, ref, reactive } from 'vue';const props = defineProps({modelValue: {type: Boolean,default: false}
});const emits = defineEmits(['update:modelValue', 'onChangeDialog']);
const isShow = computed({get() {return props.modelValue;},set(val) {emits('update:modelValue', val);}
});const onSureClick = (val) => {emits('onChangeDialog', true);
};
</script><style lang="less" scoped></style>

 完整代码 

<template><ElDialogdestroy-on-close:show-close="false":append-to-body="true"v-model="isShow"class="application-dialog"style="width: 420px; height: 266px"><div class="application-dialog-container"><img class="fail" src="@/assets/images/followOrder/fail-1.svg" /><div class="title">{{ errType.title }}</div><div class="cont">{{ errType.cont }}</div><div class="footer"><div class="but" @click="closeDialog">确定</div></div></div></ElDialog>
</template><script setup>
import { ElDialog, ElButton } from 'element-plus';
import { defineProps, defineEmits, ref, reactive } from 'vue';const props = defineProps({modelValue: {type: Boolean,default: false},errType: {type: Object,default: {title: '审核中',cont: '申请提交成功,我们的工作人员将在24小时内完成审核'}}
});const emits = defineEmits(['update:modelValue', 'onChangeDialog']);
const isShow = computed({get() {return props.modelValue;},set(val) {emits('update:modelValue', val);}
});const closeDialog = (val) => {console.log('onChangeDialog');emits('onChangeDialog', true);
};
</script>
<style lang="less">
//单独设置颜色 /deep/ :deep  ::v-deep
.application-dialog {&.el-dialog {--el-dialog-bg-color: transparent !important;.el-dialog__header,.el-dialog__body {padding: 0;}}
}
</style>
<style lang="less" scoped>
.application-dialog {position: relative;.application-dialog-container {position: absolute;width: 100%;height: 246px;background: #ffffff;border-radius: 8px;bottom: 0;padding: 70px 24px 24px;display: flex;flex-direction: column;align-items: center;justify-content: space-between;.title {color: #000;text-align: center;font-size: 18px;font-family: PingFang SC;font-style: normal;font-weight: 500;line-height: normal;}.cont {display: flex;flex-direction: column;color: #868e9b;text-align: center;font-size: 14px;font-family: PingFang SC;font-style: normal;font-weight: 500;line-height: normal;padding: 0 14px;}.footer {.but {width: 372px;height: 40px;color: #fff;font-size: 14px;font-family: PingFang SC;font-style: normal;font-weight: 500;line-height: normal;background: #000;border-radius: 5px;display: flex;justify-content: center;align-items: center;cursor: pointer;}}.fail {width: 64.632px;height: 66.607px;position: absolute;top: -20px;left: calc((100% / 2) - (64.632px / 2));}}
}
</style>

弹窗-over 

<template><el-dialogv-model="isShow":show-close="false"class="share-dialog-dialog"style="width: 319px;height: 209px;display: flex;flex-direction: column;justify-content: space-between;background-color: #fff !important;"><template #default><div class="dialog-text">确定以当前市场价格平仓?</div></template><template #footer><div class="dialog-footer"><div class="false" @click="isShow = false">取消</div><div class="true" @click="onSureClick()">确定</div></div></template></el-dialog>
</template><script setup>
import { defineProps, defineEmits, ref, reactive } from 'vue';
const props = defineProps({modelValue: {type: Boolean,default: false}
});const Bi = reactive([]);
const selectBi = (val) => {console.log(val, 888);const i = Bi.indexOf(val);if (i <= -1) {Bi.push(val);} else {Bi.splice(i, 1);}console.log(Bi, 88);
};
const emits = defineEmits(['update:modelValue', 'onChangeDialog']);
const isShow = computed({get() {return props.modelValue;},set(val) {emits('update:modelValue', val);}
});const onSureClick = (val) => {emits('onChangeDialog', true);
};
</script><style lang="less">
.el-dialog__header {margin-right: 0;
}
</style>
<style lang="less" scoped>
.share-dialog-dialog {.dialog-text {font-family: 'PingFang SC';font-size: 18px;line-height: 25px;text-align: center;padding: 20px 0;color: #000000;}.dialog-footer {display: flex;align-items: center;justify-content: space-between;color: #000;.false {padding: 10px 50px;border: 1px solid #000000;border-radius: 4px;cursor: pointer;}.true {padding: 10px 50px;background: #000;color: #fff;// background: linear-gradient(266.54deg, #f1fb6f 0%, #7cf9cd 98.94%);border-radius: 4px;cursor: pointer;}}
}
</style><!-- 使用<ClosingDialog v-model="isShow" @onChangeDialog="onChangeDialog" />import ClosingDialog from '@/views/followOrder/myTracking/components/ClosingDialog.vue';const isShow = ref(false);const onShowDialog = (show) => {isShow.value = show;};const onChangeDialog = (val) => {console.log('onSureClick', val);isShow.value = false;}; -->

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/14108.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【ElasticSearch】JavaRestClient实现索引库和文档的增删改查

文章目录 一、RestClient1、什么是RestClient2、导入demo工程3、数据结构分析与索引库创建4、初始化JavaRestClient 二、RestClient操作索引库1、创建索引库2、删除索引库3、判断索引库是否存在 三、RestClient操作文档1、新增文档2、查询文档3、修改文档4、删除文档5、批量导入…

[SWPUCTF 2022 新生赛]js_sign

[SWPUCTF 2022 新生赛]js_sign 查看源码js文件 hint的意思是敲击码 解出flag&#xff0c;记得去掉nssctf&#xff0c;包上NSSCTF{} Tap Code - 许愿星 (wishingstarmoye.com)

Linux(Ubuntu)+Qt+C++与OpenCV窗体程序使用

程序示例精选 Linux(Ubuntu)QtC与OpenCV窗体程序使用 如需安装运行环境或远程调试&#xff0c;见文章底部个人QQ名片&#xff0c;由专业技术人员远程协助&#xff01; 前言 这篇博客针对<<Linux(Ubuntu)QtC与OpenCV窗体程序使用>>编写代码&#xff0c;代码整洁&am…

基于Python爬虫+KNN数字验证码识别系统——机器学习算法应用(含全部工程源码)+训练数据集

目录 前言总体设计系统整体结构图系统流程图 运行环境Python 环境 模块实现1. 数据爬取2. 去噪与分割3. 模型训练及保存4. 准确率验证 系统测试工程源代码下载其它资料下载 前言 本项目利用Python爬虫技术&#xff0c;通过网络爬取验证码图片&#xff0c;并通过一系列的处理步…

javassist implements interface 模拟mybatis 生成代理类

动态创建代理对象的工具类 package com.wsd.util;import org.apache.ibatis.javassist.ClassPool; import org.apache.ibatis.javassist.CtClass; import org.apache.ibatis.javassist.CtMethod; import org.apache.ibatis.session.SqlSession;import java.lang.reflect.Const…

【C++ OJ练习】4.字符串中的第一个唯一字符

1.题目链接 力扣 2.解题思路 利用计数排序的思想 映射进行计数 最后计数为1的那个字符就是唯一字符 从前往后遍历 可以得到 第一个唯一字符 3.代码 class Solution { public:int firstUniqChar(string s) {//使用映射的方式统计次数 计数排序思想int count[26] { 0 };fo…

rpm包安装mysql8.0

一、环境准备 1查看本机IP地址&#xff0c;使用Xshell工具登录 [rootmysql ~]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope ho…

基于java+swing+mysql商城购物系统

基于javaswingmysql商城购物系统 一、系统介绍二、功能展示1.项目骨架2.主界面3.用户登陆4.添加商品类别5、添加商品6、商品管理 四、其它1.其他系统实现五.获取源码 一、系统介绍 项目类型&#xff1a;Java SE项目 项目名称&#xff1a;商城购物系统 用户类型&#xff1a;双…

SpringMVC跨域写入Cookie

前后端分离的项目&#xff0c;SpringMVCTomcat(SpringBoot)&#xff0c;前端Vueaxios。 不建议后端去写入Cookie&#xff0c;一般都是在前端写入Cookie&#xff0c;如果后端使用&#xff1a;CrossOrigin(origins "http://localhost", allowCredentials "true…

SpringBoot实战(二十)集成Druid连接池

目录 一、简介1.定义2.特点3.竞品对比 二、搭建测试项目1.Maven依赖2.yaml配置2.1 JDBC配置2.2 连接池配置2.3 监控配置 三、测试1.查看监控页面2.单元测试 四、补充&#xff1a;1.如何打印慢SQL&#xff1f;2.去除广告3.如何手动获取监控内容 一、简介 1.定义 Druid数据库连…

EtherCAT转TCP/IP网关ethercat最大通讯距离

天啊&#xff01;你们听说了吗&#xff1f;数据互联互通问题终于迎来了突破性进展&#xff01;作为生产管理系统的关键部分&#xff0c;数据互联互通一直是个大问题。然而&#xff0c;ETHERCAT和TCP/IP是两个不同的协议&#xff0c;它们之间的通讯一直是个大 问题。但是&#x…

【论文基本功】【LaTeX】参考文献中常见属性的用法及特点(bib文件)【IEEE论文】

【论文基本功】【LaTeX】参考文献中常见属性的用法及特点&#xff08;bib文件&#xff09;【IEEE论文】 一、author&#xff08;作者&#xff09;1. 使用方法用法1&#xff1a;作者名字的两种写法用法2&#xff1a;使用and连接不同作者姓名用法3&#xff1a;超过3个作者时如何使…