使用uni.getlocation获取当前定位成功后success调用其他方法
直接通过this.functionName()无法调用该方法,会提示下述错误
通过this.$options.methods.functionName()直接调用, 会提示下述错误
success中拿不到vue中的this,可以用bind()绑定(success后),或者用that存储this
getAaddress(){
let that = this
uni.getLocation({
geocode: true,
type: 'gcj02',
success(res) {
that.getStoreList()//调用其他方法
},
fail(err) {
console.log('获取地理位置失败')
uni.showToast({
title:'位置信息加载异常',
icon:'error'
})
}
})
}