微信小程序开发遇到的问题(自用)

2021-01-08  本文已影响0人  tysnd

添加遮罩层,禁止下层滚动

// 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位,而且偏差很大

上一篇 下一篇

猜你喜欢

热点阅读