html代码
<button type="primary" @click="discount">点击事件</button>
<view class="discount" :class="showt?'':'discount_dh'">
</view>
<view class="tui-actionsheet-mask" @touchmove.stop.prevent="" :class="[showt?'':'tui-mask-showt']" @tap="handleClickMask"></view>
js代码
export default {
data() {
return {
//点击遮罩 是否可关闭
maskClosable: {
type: Boolean,
default: true
},
//文本内容是否展示
showt: {
type: Boolean,
default: false
}
}
},
methods: {
//点击事件
discount(){
console.log(123);
this.showt=false
},
//点击灰朦层是否关闭
handleClickMask() {
this.showt=true
}
}
}
css代码
.discount{
position: fixed;
bottom: 0;
width: 100%;
/* height: 299rpx; */
z-index: 9999;
background-color: #FFFFFF;
transform: translate3d(0, 100%, 0);
transform-origin: center;
transition: all 0.3s ease-in-out;
visibility: hidden;
}
.discount_dh{
transform: translate3d(0, 0, 0);
visibility: visible;
}
.tui-actionsheet-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.6);
z-index: 9996;
transition: all 0.3s ease-in-out;
opacity: 0;
visibility: hidden;
}
.tui-mask-showt {
opacity: 1;
visibility: visible;
}
给灰朦层添加 @touchmove.stop.prevent="" 设置滑动事件 就可以取消滑动 需要的效果自己添加 这个样式是根据官网文档 拿下来的