Files

76 lines
1.8 KiB
Vue
Executable File

<template>
<view v-show="maskShow" @touchmove.stop.prevent="moveHandle" class="opsoft-mask" @tap.stop="maskClick">
<view :class="maskHideTitle?'opsoft-mask-content':'opsoft-mask-title'" :style="maskHideTitle?maskStyleData:{}"/>
<view :style="maskStyleData" class="opsoft-mask-content"/>
</view>
</template>
<script>
export default {
name:"opsoft-mask",
props:{
maskShow: {type:Boolean, default:false},
maskStyle: {type:Object, default:()=>{}},
maskHideTitle: {type:Boolean, default:false},
maskBackgroundColor: {type:String, default:false},
},
watch:{
maskBackgroundColor: {
handler (newVal, oldVal) {
this.maskStyleData = new Object();
Object.assign(this.maskStyleData, this.maskStyle);
this.maskStyleData.backgroundColor = newVal;
},
},
maskStyle: {
handler (newVal, oldVal) {
this.maskStyleData = new Object();
Object.assign(this.maskStyleData, newVal);
this.maskStyleData.backgroundColor = this.maskBackgroundColor;
},
deep: true,
},
},
data(){
return {
maskStyleData: null,
}
},
created() {
this.maskStyleData = new Object();
Object.assign(this.maskStyleData, this.maskStyle);
this.maskStyleData.backgroundColor = this.maskBackgroundColor;
},
methods:{
maskClick: function() {
console.log("this.maskShow", this.maskShow);
this.$emit("maskClick", this.maskShow);
},
moveHandle: function() {
}
}
}
</script>
<style lang="scss">
.opsoft-mask{
width: 100%;
height: 100%;
position: fixed;
top:0%;
left:0%;
z-index: 999;
background-color: #000000;
opacity: 0.5;
.opsoft-mask-title{
width: 100%;
height: 44px;
}
.opsoft-mask-content{
width: 100%;
height: 100%;
}
}
</style>