<template>
<view>
<view class="systemboxItem" @click="showSystemDialog(index)" v-for="(item,index) in system" :key="index">
<view class="systemboxItemTop">
<span class="systemboxItemTopLeft">{{item.title}}</span>
<span class="systemboxItemTopRight">{{item.replaceTime}}</span>
</view>
<view class="systemboxItemBottom">
<span class="systemInformation"></span>
<span class="redLittle"></span>
</view>
</view>
<messageDialog :content="dialogContent"></messageDialog>
</view>
</template> <script>
import Utils from '@/common/js/center.js';
import messageDialog from '@/common/compoents/message-window/message-window.vue'
export default {
data() {
return {
system: [{
title: 1111,
replaceTime: '2019-8-7',
content: '1↵2↵3.↵4↵5↵6↵7↵8↵9↵10↵11↵12↵13↵14↵15↵↵'
}],
dialogContent: ''
}
},
methods: {
// 查看系统设置
showSystemDialog() {
this.dialogContent = this.system[index].content
Utils.$emit('is-show-message-mask');
},
}
}
</script>
<style lang="less">
.systemboxItem {
padding: 8upx 30upx;
height: 100upx;
background-color: #fff;
box-sizing: border-box;
margin-bottom: 20upx; .systemboxItemTop {
font-size: 30upx; .systemboxItemTopRight {
float: right;
color: #A0A0A0;
}
} .systemboxItemBottom {
margin-top: 10upx;
font-size: 25upx;
color: #A0A0A0; .systemInformation {
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 70%;
} .redLittle {
border-radius: 50%;
width: 20upx;
height: 20upx;
background-color: #EF415C;
display: inline-block;
float: right;
margin-top: 7upx;
}
}
}
</style>

父组件

<template>
<view class="dialog" @click="dialogClose" v-if="isShowDialog">
<!-- <view class="dialog-block"> -->
<view class="dialog-content" @click.stop="" :class="isShowMaskContent ? 'show-dialog' : 'hide-dialog'">
<scroll-view :scroll-y="true" class="dialog-list">
<text>{{content}}</text>
</scroll-view>
<view class="dialog-close iconfont iconfabu-guanbi1" @click="dialogClose"></view>
</view>
<!-- </view> --> </view>
</template> <script>
import Utils from '@/common/js/center.js';
export default {
props: ['content'],
data() {
return {
isShowDialog: false, // 整个弹窗
isShowMaskContent: false, // 白色填充区域
}
},
methods: {
dialogClose() {
let that = this;
that.isShowMaskContent = false;
setTimeout(function() {
that.isShowDialog = false;
that.$forceUpdate();
}, 100);
},
},
mounted() {
let that = this;
// 显示遮罩
Utils.$on('is-show-message-mask', () => {
that.isShowMaskContent = true;
that.isShowDialog = true;
});
}
}
</script> <style scoped>
.dialog {
width: 100%;
height: 100vh;
background: rgba(0, 0, 0, 0.5);
z-index: 999;
position: fixed;
left: 0;
top: 0;
padding-top: 10vh;
} .dialog-block {} .dialog-content {
width: 500upx;
height: 80vh;
margin: 0 auto;
background: #FFF;
border-radius: 10upx;
overflow: hidden;
position: relative;
} .dialog-close {
width: 40upx;
height: 40upx;
border-radius: 20upx;
position: absolute;
right: 10upx;
top: 10upx;
font-size: 26upx;
line-height: 40upx;
text-align: center;
} .dialog-list {
padding: 40upx 20upx;
} scroll-view {
width: 100%;
height: 100%;
} .show-dialog {
animation: 100ms showDialog linear forwards;
} .hide-dialog {
animation: 100ms hideDialog linear forwards;
} @keyframes hideDialog {
0% {
opacity: 1;
} ,
100% {
opacity: 0;
}
} @keyframes showDialog {
0% {
opacity: 0;
} ,
100% {
opacity: 1;
}
}
</style>

子组件(弹窗)

uni-app实现弹窗遮罩的更多相关文章

  1. js动画 无缝轮播 进度条 文字页面展示 div弹窗遮罩效果

    1.无缝轮播 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.a ...

  2. jQuery 小特效【文本框折叠隐藏,展开显示】【下拉菜单】【颜色渐变】【弹窗+遮罩】

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs& ...

  3. easyui 中iframe嵌套页面,提示弹窗遮罩的解决方法,parent.$.messager.alert和parent.$.messager.confirm

    项目中用到easyui 布局,用到north,west,center三个区域,且在center中间区域嵌入iframe标签.在主内容区做一些小提示弹窗(例如删除前的弹窗提示确认)时,会遇到遮罩问题,由 ...

  4. appium+python自动化47-首次打开app权限弹窗问题

    前言 用真机运行appium代码,首次打开app有的手机会出现权限弹窗问题,一般这种弹窗都是在引导页前面或者引导页后面出现.权限弹窗上面的按钮都是固定的, 只需要定位到"始终允许" ...

  5. uni app中使用自定义图标库

    项目中难免会用到自定义图标,那在uni app中应该怎么使用呢? 首先, 将图标目录放在static资源目录下: 在main.js中引入就可以全局使用了 import '@/static/icon-o ...

  6. 7.0 启动app权限弹窗问题

    这里提供两种解决方案! 1.安卓6.0+是可以直接利用uiautomator定位元素点击!这个不细说,定位方式很多种...这个等待时间大家自己定大概两到三秒即可! #安卓6.0+点击方式driver. ...

  7. H5当弹出弹窗遮罩时如何阻止滚动穿透(使用css方式)

    最近的一个H5活动中有一个是点击[分享]弹窗指引遮罩弹窗引导用户进行分享,但突然发现弹出弹窗的时候下层仍然可以进行滑动,这个问题是个H5经久不衰讨论的问题,重点是我这个页面在安卓系统上有明显的滑动闪烁 ...

  8. uni app 零基础小白到项目实战-1

    uni-app是一个使用vue.js开发跨平台应用的前端框架. 开发者通过编写vue.js代码,uni-app将其编译到Ios,android,微信小程序等多个平台,保证其正确并达到优秀体验. Uni ...

  9. mui 禁止透明背景点击关闭弹窗遮罩

    //禁止关闭遮罩 window.addEventListener('tap', function(e) { e.target.className == 'mui-backdrop mui-active ...

随机推荐

  1. Linux centosVMware zabbix主动模式和被动模式、添加监控主机、添加自定义模板、处理图形中的乱码、自动发现

    一.主动模式和被动模式 主动或者被动是相对客户端来讲的 被动模式,服务端会主动连接客户端获取监控项目数据,客户端被动地接受连接,并把监控信息传递给服务端 主动模式,客户端会主动把监控数据汇报给服务端, ...

  2. java中如何修改事务的隔离级别

    事务的特性: 原子性(Atomicity)原子性是指事务是一个不可分割的工作单位,事务中的操作要么都发生,要么都不发生. (多条语句要么都成功,要么都失败.) 一致性(Consistency)事务前后 ...

  3. luogu P3356 火星探险问题

    本题很简单的费用流问题,有石头的点需要限制,那我们就可以拆点,capacity为1就可以限制,然后cost为-1,直接跑板子就可以了,注意输出的时候找残量网络的反向边

  4. Ubuntu 解决TXT文本乱码问题

    只要依次在终端输入这两行指令即可: gsettings set org.gnome.gedit.preferences.encodings auto-detected "['GB18030' ...

  5. 113、Java中String类之字符串文本分割IP地址

    01.代码如下: package TIANPAN; /** * 此处为文档注释 * * @author 田攀 微信382477247 */ public class TestDemo { public ...

  6. win7系统实现内外网同时连接图文教程

    解决方案:修改路由表 在工作中,经常会遇到切换内外网的网络情况,通常情况下都是断开/连接网络,很麻烦.我们可以使用route命令来解决此类问题,route add.route delete.route ...

  7. 分析一次double强转float的翻车原因(转载)

    https://www.cnblogs.com/CoderAyu/p/11489577.html float只能保证7位有效数字. double d = 8345933; float f = (flo ...

  8. centos安装出现dracut-initqueue timeout错误

    dracut:/# cd /dev dracut:/# ls 这样子你就会看到所有的设备信息. 找到sda4,  不一定是sda4,有可能是其他的,实在不确定就拔了优盘看一下哪个消失了 dracut: ...

  9. CentOS6.9安装MySQL(编译安装、二进制安装)

    目录 CentOS6.9安装MySQL Linux安装MySQL的4种方式: 1. 二进制方式 特点:不需要安装,解压即可使用,不能定制功能 2. 编译安装 特点:可定制,安装慢 5.5之前: ./c ...

  10. PIL pip error

    结果显示: 提示——Could not find a version that satisfies the requirement PIL (from versions: )No matching d ...