watchOrient: function() {
var that = this;
if (that.watchId) {
return;
}
that.watchId = plus.orientation.watchOrientation(function(o) {
//that.value = "监听设备方向变化信息\n" + "alpha:" + o.alpha + "\nbeta:" + o.beta + "\ngamma:" + o.gamma;
that.rotate = parseInt(o.alpha);
}, function(e) {
console.log("监听设备方向失败:" + e.message);
plus.orientation.clearWatch(that.watchId);
that.watchId = null;
that.watchOrient();
});
},
![5***@qq.com](https://img-cdn-tc.dcloud.net.cn/account/identicon/f705d34f9025d26d3e1d8aa92c73760a.png)
- 发布:2020-08-30 10:32
- 更新:2020-09-08 13:52
- 阅读:1063
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: win7
HBuilderX类型: 正式
HBuilderX版本号: 2.8.8
手机系统: Android
手机系统版本号: Android 7.0
手机厂商: 模拟器
手机机型: 。。。。。
页面类型: vue
打包方式: 云端
项目创建方式: HBuilderX
示例代码:
操作步骤:
plus.orientation.watchOrientation
plus.orientation.watchOrientation
预期结果:
正常获取设备角度
正常获取设备角度
实际结果:
e.setInterval is not a function
e.setInterval is not a function
bug描述:
nvue e.setInterval is not a function
2 个回复
slambb - 神copy程序员
plus.accelerometer.watchAcceleration 好像也是一样。2.8.8 版本。android 报错 [Vue warn]: Error in onLoad hook: "TypeError: e.setInterval is not a function"。ios正常
Liew - 全栈奶爸
遇到同样问题