WeChat Mini Programs wx.getLocation returns errMsg: "getLocation:fail no permission"

1. WeChat Mini Programs wants to get the current location, but calls wx.getLocation to say that he has no permission. I think the map component of the official website does not have the code for authorization.
2. Here is my code:
//getLaLo
getLaLo: function () {
    wx.getLocation({
      type: "wgs84",
      success: function (res) {
        var latitude = res.latitude
        var longitude = res.longitude
        var speed = res.speed
        var accuracy = res.accuracy
        console.log("this:",this)
        this.setData({
          la: latitude,
          lo: longitude
        }) 
      },
      fail: function(err) {
        console.log(err)
      },
    })
3. Then this is the error message:
errMsg:"getLocation:fail no permission"
4. If you change it according to the answer, you will still report an error. I am also very desperate, you gods help Xiaobai

Mar.30,2021

user authorization is required, user permission is required


onLoad: function (options) {
    this._getLocation();
},

//
  _getLocation: function () {
    var that = this;
    wx.getLocation({
      type: 'wgs84',
      success: function (res) {
        that.setData({
          latitude: res.latitude,
          longitude: res.longitude
        })
      }
    });
  },

you try this code

:


( _ )
appid,
clipboard.png
I was surprised to find that the appid I used is also a test number. I don't know if that's the reason, but I still want to thank this classmate ~


to see if this article helps
errMsg:getLocation:fail:require permission desc- Mini Program can't locate


add this to app.json. Try id to use your own id, not the test

.
"permission": {
    "scope.userLocation": {
      "desc": ""
    }
  }
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36646-2c002.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36646-2c002.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?