求助 想做类似摇一摇功能,加速度计API ,BUG?
/** * 生命周期函数--监听页面显示 */ onShow: function () { wx.onAccelerometerChange( function (res) { if (res.x>1&&res.y>1){ console.log( "111" ) console.log(res.x) console.log(res.y) console.log(res.z) wx.stopAccelerometer() } }) }, |
预想:摇晃一次手机打印一次。
实际:第一次进入此页面摇晃一次手机打印一次,然后返回前一个页面再次进入此页面摇晃一次手机打印了两次且数据相同,以此类推第几次进入此页面就打印几次。。。这是什么原因呀 BUG? 还是?(附图)


