uni-app实现弹窗遮罩

摘要:
----˃{{content}}˂!

uni-app实现弹窗遮罩第1张

uni-app实现弹窗遮罩第2张uni-app实现弹窗遮罩第3张
<template>
    <view>
        <view   @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;
                 70%;
            }

            .redLittle {
                border-radius: 50%;
                 20upx;
                height: 20upx;
                background-color: #EF415C;
                display: inline-block;
                float: right;
                margin-top: 7upx;
            }
        }
    }
</style>
父组件
uni-app实现弹窗遮罩第4张uni-app实现弹窗遮罩第5张
<template>
    <view   @click="dialogClose" v-if="isShowDialog">
        <!-- <view class="dialog-block"> -->
        <view   @click.stop="" :class="isShowMaskContent ? 'show-dialog' : 'hide-dialog'">
            <scroll-view :scroll-y="true" class="dialog-list">
                <text>{{content}}</text>
            </scroll-view>
            <view   @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 {
         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 {
         500upx;
        height: 80vh;
        margin: 0 auto;
        background: #FFF;
        border-radius: 10upx;
        overflow: hidden;
        position: relative;
    }

    .dialog-close {
         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 {
         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实现弹窗遮罩》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇Selenium使用总结(Java版本)dpdk+ovs安装和编译(一)下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

随便看看

webpack打包(1)

Webpack可以处理js/json资源。生成环境比开发环境具有更多的功能来压缩代码。它可以将ES6模块化为浏览器在webpack.config中识别的模块操作命令npmiwebpackwebpack-cli-g npminit npmiwebpack-cli-D配置并运行webpack以将webpack.config.js文件打包...

GIS中的数据库.gdb与.mdb的区别

Gdb是文件地理数据库,mdb是个人地理数据库,两者都是数据库文件类型。个人地理数据库是基于access数据库的个人数据库格式mdb,可存储不超过2G的文件,仅适用于Windows系统;文件数据库是保存在文件系统文件夹中的各种类型的GIS数据集的集合。请参阅文章“GIS中database.gdb和.mdb之间的区别是什么?”,m892832piczpec5。...

QSS基础-设置控件样式

1.QSS基础-设置类似控件的样式“QSS基础:QtStyleSheetQt样式表用于设置控件的样式和样式(例如控件的背景色、字体颜色、字体大小等)。功能与CSS相似。功能类似。“”从PyQt5.Qt重新导入*从PyQt5.QtGuidimport*从PyQt5.QtWidgetsimport*importsysclassBasicQSS(QWidget):...

微信小程序知识点总结--组件

aspectFill缩放模式保持缩放图像的纵横比,并且只能完全显示图像的短边。也就是说,图片通常只在水平或垂直方向上是完整的,而另一个方向会被截取。...

【转】 中兴OLT-C300常用命令

在当前的C220版本中,ONU类型名称在GPON和EPON中应该是唯一的。这里我们使用“ZTEG-F620”。ZXAN#ponZXAN#onu-typegponZTEG-F620描述4ETH,2POTSZXAN#onu-ifZTEG-F620eth_0/1-4ZXAN#onon-ifZTEG-F620pots_0/1-2ZXAN#on u type attr...

ES6学习之对象的遍历

写在前面的话:在es6中一共有五种遍历对象的方法,如下:for...infor...in循环遍历对象自身的和继承的可枚举属性。Object.getOwnPropertySymbolsObject.getOwnPropertySymbols返回一个数组,包含对象自身的所有Symbol属性的键名。其结果为:从结果可以看出对boy对象的遍历可以得到他的直接身的属性...