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

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

// wxml

  aaaaa


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

你可能感兴趣的:(微信小程序开发遇到的问题(自用))