Use uni.getLocation to get the current location success and success calls the other methods
The method cannot be called directly from this.functionname () and the following error is displayed
Through this $options. The methods. FunctionName () call directly, you will be prompted the following error
You can use bind() to bind this (after success) or use that to store this (after success)
getAaddress(){ let that = this uni.getLocation({ geocode: true, type: 'gcj02', success(res) {that.getStorelist ()// Call other methods}, Fail (err) {console.log(' failed to get location ') uni.showToast({title:' error', icon:'error'})})}Copy the code