ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
[TOC] > [参考](https://uniapp.dcloud.net.cn/api/system/gyroscope) ## 概述 实例 ``` <template> <view> <button @click="start">开始监听陀螺仪变化</button> <button @click="stop">停止监听陀螺仪变化</button> </view> </template> export default { methods: { start() { uni.onGyroscopeChange((res) => { console.log('gyroData.rotationRate.x = ' + res.x) console.log('gyroData.rotationRate.y = ' + res.y) console.log('gyroData.rotationRate.z = ' + res.z) }); uni.startGyroscope({ interval: "normal", success() { console.log('success') }, fail() { console.log('fail') } }) }, stop(){ uni.stopGyroscope({ success() { console.log('stop success!') }, fail() { console.log('stop fail!') } }) } } } ```