有人写过小程序摇一摇吗!求教!

发布于 8 年前作者 fmo14650 次浏览最后编辑 8 年前来自 ask
wx.onAccelerometerChange(function (e) {
       if (e.x > 0.2 && e.y > 0.2) {
           request(api.lootery, 'post', { openid: wx.getStorageSync('openid') }).then((res) => {
               console.log(res)
               that.setData({
                   show: true,
                   message: res.data.Message
               })
           })
       }
   })

现在这种情况摇晃的时候会一直请求接口

1 回复
rfan
rfan1 楼6 年前

你写的,就是有0.2的晃动就请求接口啊