添加遮罩层,禁止下层滚动
// wxml
<view class="shade" wx:if="{{show}}" catchtouchmove='func'>
<view class="content" bindtap="xxx">aaaaa</view>
</view>
// wxss
.shade {
width:100%;
height:100vh;
top:0;
background:rgba(0,0,0,0.5);
overflow: hidden;
z-index: 1;
position: fixed;
}
其中,设置catchtouchmove后,在开发工具上是测试不出来的,下层仍然滚动,但真机测试可以
wx.request改成同步
https://blog.csdn.net/weixin_44268792/article/details/106988473
微信小程序引用外部json文件
wx.request({
url: ‘xxxxxxxxx’,
success: function (res) {
console.log('json', res)
jsonData = JSON.parse(res.data)
}
})
wx.getLocation提高精度
参数type
采用gcj02
而非wgs84
。
gcj02
返回的经纬度,小数点后保留14位
wgs84
返回的经纬度,小数点后保留6位
一定要用真机调试!!!!开发工具上都是返回5位,而且偏差很大
网友评论