uni-app实现弹窗遮罩
<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实现弹窗遮罩的更多相关文章
- js动画 无缝轮播 进度条 文字页面展示 div弹窗遮罩效果
1.无缝轮播 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.a ...
- jQuery 小特效【文本框折叠隐藏,展开显示】【下拉菜单】【颜色渐变】【弹窗+遮罩】
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs& ...
- easyui 中iframe嵌套页面,提示弹窗遮罩的解决方法,parent.$.messager.alert和parent.$.messager.confirm
项目中用到easyui 布局,用到north,west,center三个区域,且在center中间区域嵌入iframe标签.在主内容区做一些小提示弹窗(例如删除前的弹窗提示确认)时,会遇到遮罩问题,由 ...
- appium+python自动化47-首次打开app权限弹窗问题
前言 用真机运行appium代码,首次打开app有的手机会出现权限弹窗问题,一般这种弹窗都是在引导页前面或者引导页后面出现.权限弹窗上面的按钮都是固定的, 只需要定位到"始终允许" ...
- uni app中使用自定义图标库
项目中难免会用到自定义图标,那在uni app中应该怎么使用呢? 首先, 将图标目录放在static资源目录下: 在main.js中引入就可以全局使用了 import '@/static/icon-o ...
- 7.0 启动app权限弹窗问题
这里提供两种解决方案! 1.安卓6.0+是可以直接利用uiautomator定位元素点击!这个不细说,定位方式很多种...这个等待时间大家自己定大概两到三秒即可! #安卓6.0+点击方式driver. ...
- H5当弹出弹窗遮罩时如何阻止滚动穿透(使用css方式)
最近的一个H5活动中有一个是点击[分享]弹窗指引遮罩弹窗引导用户进行分享,但突然发现弹出弹窗的时候下层仍然可以进行滑动,这个问题是个H5经久不衰讨论的问题,重点是我这个页面在安卓系统上有明显的滑动闪烁 ...
- uni app 零基础小白到项目实战-1
uni-app是一个使用vue.js开发跨平台应用的前端框架. 开发者通过编写vue.js代码,uni-app将其编译到Ios,android,微信小程序等多个平台,保证其正确并达到优秀体验. Uni ...
- mui 禁止透明背景点击关闭弹窗遮罩
//禁止关闭遮罩 window.addEventListener('tap', function(e) { e.target.className == 'mui-backdrop mui-active ...
随机推荐
- postInvalidate 解决View.GONE,没有刷新的问题
问题描述:布局: <ScrollView id="scroll"> <LinearLayout id="container"> < ...
- 「Luogu P2824 [HEOI2016/TJOI2016]排序」
一道十分神奇的线段树题,做法十分的有趣. 前置芝士 线段树:一个十分基础的数据结构,在这道题中起了至关重要的作用. 一种基于01串的神奇的二分思想:在模拟赛中出现了这道题,可以先去做一下,这样可能有助 ...
- Django 执行 manage 命令方式
本人使用的Pycharm作为开发工具,可以在顶部菜单栏的Tools->Run manage.py Task直接打开manager 命令控制台 打开后在底部会有命令窗口: 或者,也可以在Pytho ...
- python3 引入selenium库报错ModuleNotFoundError: No module named 'selenium'
解决方法: pip install -U selenium
- main.js index.html与app.vue三者关系详解
main.js index.html与app.vue三者关系详解 2019年01月23日 11:12:15 Pecodo 阅读数 186 main.js与index.html是nodejs的项目启 ...
- Unity初识项目结构与面板
一.Unity的项目结构 Unity中的一个项目是有若干个场景组成的,每一个场景又是由若干个游戏对象组成的,每一个游戏对象身上有若干个组件,每一个组件有若干个属性. 项目——>场景——>游 ...
- Python Download Image (python + requests + BeautifulSoup)
环境准备 1 python + requests + BeautifulSoup 页面准备 主页面: http://www.netbian.com/dongman/ 图片伪地址: http://www ...
- 易升地址,windows 10, 1511 升级 1607 仍然有效
https://www.microsoft.com/zh-cn/software-download/windows10 易升地址, windows 10 ,1511 升级 1607 仍然有效
- k-近邻算法的优缺点及拓展思考
//2019.08.03晚#k-近邻算法的拓展思考与总结1.k-近邻算法是一种非常典型的分类监督学习算法,它可以解决多分类的问题:另外,它的整体思想简单,效果强大.它也可以用来解决回归问题,使用的库函 ...
- 记一次海洋cms任意代码执行漏洞拿shell(url一句话)
实验环境:海洋CMS6.54(后续版本已该洞已补) 1.后台登录尝试 这个站点是个测试站,站里没什么数据. 进入admin.php,是带验证码的后台登录系统,没有验证码的可以用bp爆破.有验证码的也有 ...