1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > css小记:弹出框与遮罩层(遮罩层内的元素不能被点击)

css小记:弹出框与遮罩层(遮罩层内的元素不能被点击)

时间:2020-02-09 09:30:47

相关推荐

css小记:弹出框与遮罩层(遮罩层内的元素不能被点击)

<template><view class="app"><button type="default" @click="qiehuan()">点击我</button><view class="" v-if="suzi"><view class="zhezhao" ><view class="" @click="dianji()">点击我</view></view><view class="fangkuang">我是弹出框</view></view></view></template><script>export default {data() {return {suzi: false};},methods:{qiehuan:function() {console.log(this.suzi)this.suzi = !this.suzi},dianji:function() {console.log(666)}}}</script><style lang="scss">.zhezhao {height: 100vh;width: 100vw;opacity: 0.5; background: rgba(0, 0, 0, 0.4);pointer-events: none;//让遮罩层里面的元素不能被点击}.fangkuang {top: 50%;left: 50%;//以元素的左上角为起点并不是完全居中还有自己本身的距离transform: translate(-50%,-50%);//这个是指向上向左偏移自己的一半height: 300upx;width: 300upx;position: absolute;background: #FFFFFF;animation: mymove 2s ;z-index: 100;@keyframes mymove {from{opacity: 0;}to {opacity: 1;}}@keyframes mymove {from{height: 100upx;width: 100upx;}to {height: 300upx;width: 300upx;}}}</style>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。