on-compass-change.js 211 Bytes Edit Raw Blame History Permalink 1 2 3 4 5 6 7 8 9 10 11 12 13 Page({ data: { direction: 0 }, onReady: function () { var that = this wx.onCompassChange(function (res) { that.setData({ direction: parseInt(res.direction) }) }) } })