[Vue]H5学习之自定义弹窗

2024-09-03 15:08

本文主要是介绍[Vue]H5学习之自定义弹窗,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

目录

  • 自定义弹窗组件
    • 完成截图
    • 步骤

自定义弹窗组件

完成截图

在这里插入图片描述

步骤

第一步:
新建一个Dialog.vue文件:

<template><div id="dialog"><div class="border" ><div><p class="titleStyle">打卡</p></div><div class="table-style"><div class="table-describe-style">时间</div><div class="table-content-style">{{currentTimeStr}}</div></div><div class="table-style"><div class="table-describe-style">网格</div><div class="table-content-style">第一网格</div></div><div class="table-style"><div class="table-describe-style">位置</div><div class="table-content-style">{{positionStr}}</div></div><div class="table-style"><div class="table-describe-style">描述</div><div class="table-content-style"><textarea class="check-mes fc-black" placeholder="请输入相关要求" v-model="msg" required></textarea></div></div><div class="button-align-bottom"><div class="horizontal-line-style"></div><div class="button-align-bottom-style"><div class="cancel-button" @click="closeDialog">取消</div><div class="vertical-line-style"></div><div class="punch-button">打卡</div></div></div></div></div>
</template>
<script>import { Field } from 'mint-ui';import Vue from 'vue'Vue.component(Field.name, Field);export default {name: "",props: {//用于父布局传参currentTimeStr:String,positionStr:String},data(){return {}},components: {'upload-pictures': Upload},methods:{closeDialog(){//给父组件传参this.$emit('closeDialog',false)}}}
</script><style scoped>#dialog{position: fixed;top: 0;left: 0;background: rgba(0,0,0,0.3);width: 100%;height: 100%;}.fc-black {color: #333 !important;}.check-mes {display: block;width: 100%;height: 80px;background-color:  #F7F7F7;padding: 10px;font-size: 16px;line-height: 20px;border-radius: 5px;}.horizontal-line-style{background: #DCDCDC;width: 100%;height: 1px;}.vertical-line-style{background: #000;width: 1px;height: 100%;}.titleStyle{margin-top: 20px;font-size: 18px;color: #333333;letter-spacing: 0;text-align: center;line-height: 26px;font-weight: bold;}.table-style{margin-left: 20px;margin-right: 20px;display: flex;}.table-content-style{font-size: 16px;color: #333333;line-height: 24px;padding-left: 10px;padding-right: 10px;padding-top: 5px;padding-bottom: 5px;order: 2;word-wrap: break-word;overflow: hidden;}.table-describe-style{color: #999999;letter-spacing: 0;font-size: 16px;line-height: 24px;padding-top: 5px;padding-bottom: 5px;width: 40px ;order: 1;flex:0 0 auto;}.table-content-remark{background: #F7F7F7;border-radius: 6px;font-size: 16px;color: #333333;}.border{background-color: white;border-radius: 6px;width: 80%;height: 68%;position: absolute;left: 10%;top: 17%;/*transform: translate(-50%,-50%);*/}.media-upload-categray-type{margin-left: 20px;margin-right: 20px;margin-top: 20px;display: flex;}.cancel-button{width: 50%;text-align: center;font-size: 18px;color: #666666;letter-spacing: 0;line-height: 44px;background: #FFFFFF;}.punch-button{flex-grow:1;text-align: center;color: #3A90F6;line-height: 44px;font-size: 18px;letter-spacing: 0;background: #FFFFFF;}.button-align-bottom{bottom: 5px;position:absolute;width: 100%;}.button-align-bottom-style{width: 100%;display: flex;}
</style>

第二步:
父布局调用及传参

//1 导入文件并声明控件
<template><Dialog @closeDialog="close" v-if="isShowDialog" :currentTime="currentTimeString"></Dialog>
</template>
<script>.....import Vue from 'vue'import Dialog from './Dialog.vue'Vue.component('Dialog',Dialog).....
</script>

这篇关于[Vue]H5学习之自定义弹窗的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1133304

相关文章

Vue中组件之间传值的六种方式(完整版)

《Vue中组件之间传值的六种方式(完整版)》组件是vue.js最强大的功能之一,而组件实例的作用域是相互独立的,这就意味着不同组件之间的数据无法相互引用,针对不同的使用场景,如何选择行之有效的通信方式... 目录前言方法一、props/$emit1.父组件向子组件传值2.子组件向父组件传值(通过事件形式)方

如何自定义Nginx JSON日志格式配置

《如何自定义NginxJSON日志格式配置》Nginx作为最流行的Web服务器之一,其灵活的日志配置能力允许我们根据需求定制日志格式,本文将详细介绍如何配置Nginx以JSON格式记录访问日志,这种... 目录前言为什么选择jsON格式日志?配置步骤详解1. 安装Nginx服务2. 自定义JSON日志格式各

css中的 vertical-align与line-height作用详解

《css中的vertical-align与line-height作用详解》:本文主要介绍了CSS中的`vertical-align`和`line-height`属性,包括它们的作用、适用元素、属性值、常见使用场景、常见问题及解决方案,详细内容请阅读本文,希望能对你有所帮助... 目录vertical-ali

Android自定义Scrollbar的两种实现方式

《Android自定义Scrollbar的两种实现方式》本文介绍两种实现自定义滚动条的方法,分别通过ItemDecoration方案和独立View方案实现滚动条定制化,文章通过代码示例讲解的非常详细,... 目录方案一:ItemDecoration实现(推荐用于RecyclerView)实现原理完整代码实现

浅析CSS 中z - index属性的作用及在什么情况下会失效

《浅析CSS中z-index属性的作用及在什么情况下会失效》z-index属性用于控制元素的堆叠顺序,值越大,元素越显示在上层,它需要元素具有定位属性(如relative、absolute、fi... 目录1. z-index 属性的作用2. z-index 失效的情况2.1 元素没有定位属性2.2 元素处

Python实现html转png的完美方案介绍

《Python实现html转png的完美方案介绍》这篇文章主要为大家详细介绍了如何使用Python实现html转png功能,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 1.增强稳定性与错误处理建议使用三层异常捕获结构:try: with sync_playwright(

基于Spring实现自定义错误信息返回详解

《基于Spring实现自定义错误信息返回详解》这篇文章主要为大家详细介绍了如何基于Spring实现自定义错误信息返回效果,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录背景目标实现产出背景Spring 提供了 @RestConChina编程trollerAdvice 用来实现 HTT

Vue 调用摄像头扫描条码功能实现代码

《Vue调用摄像头扫描条码功能实现代码》本文介绍了如何使用Vue.js和jsQR库来实现调用摄像头并扫描条码的功能,通过安装依赖、获取摄像头视频流、解析条码等步骤,实现了从开始扫描到停止扫描的完整流... 目录实现步骤:代码实现1. 安装依赖2. vue 页面代码功能说明注意事项以下是一个基于 Vue.js

SpringSecurity 认证、注销、权限控制功能(注销、记住密码、自定义登入页)

《SpringSecurity认证、注销、权限控制功能(注销、记住密码、自定义登入页)》SpringSecurity是一个强大的Java框架,用于保护应用程序的安全性,它提供了一套全面的安全解决方案... 目录简介认识Spring Security“认证”(Authentication)“授权” (Auth

CSS @media print 使用详解

《CSS@mediaprint使用详解》:本文主要介绍了CSS中的打印媒体查询@mediaprint包括基本语法、常见使用场景和代码示例,如隐藏非必要元素、调整字体和颜色、处理链接的URL显示、分页控制、调整边距和背景等,还提供了测试方法和关键注意事项,并分享了进阶技巧,详细内容请阅读本文,希望能对你有所帮助...