uniapp的api中使用this不指向vue实例对象的问题
场景还原:// 比如在uni.getLocation方法中使用this修改data中的数据,this指向会出错uni.getLocation({ type: 'wgs84', success: function (res) { console.log('当前位置的经度:' + res.longitude); console.log('当前位置的纬度:' + res.latitude); // 这里的this指向会出错,所以数据也不会修改成功
原创
2021-02-09 09:24:06 ·
1028 阅读 ·
0 评论