2022-03-15 uni-app 微信小程序movable-
2022-03-15 本文已影响0人
半眼鱼
先上解决办法:
.movable-area{
position:fixed;
top:0;
left:0;
width:750rpx;
height:100%;
pointer-events: none;
}
.movable-view{
color:#F00;
position:relative;
pointer-events: auto;
width:auto;
height:auto;
display:inline-block;
}

看微信小程序需求

微信小程序有个组件:
movable-area 【看手册】
movable-view 【看手册】
就是它,看看直接拿来用的效果:

OK,效果出来了,里面的样式怎么写就不说了,直接粘贴 area 和 view 的样式:

.movable-area{
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
}
.movable-view{
color:#F00;
position:relative;
width:auto;
height:auto;
display:inline-block;
}
可以看到,area 将整个页面都遮住了,现在出问题了,就是点击的时候,页面上的其他元素点不到,只能点到 area 上,这时候你能想到的估计就是 事件的穿透属性了吧,
pointer-events ,【看手册】
先看结果:

领导来了,不说了,直接上解决办法,拜拜
.movable-area{
position:fixed;
top:0;
left:0;
width:750rpx;
height:100%;
pointer-events: none;
}
.movable-view{
color:#F00;
position:relative;
pointer-events: auto;
width:auto;
height:auto;
display:inline-block;
}
