WeChat applet map navigation is invalid in onload

The WeChat applet provides an embedded map and calls the navigation function of the map app in the mobile phone. The code is as follows:

js:

  marker tap (s) {
    var latitude = e.currentTarget.dataset.latitude
    var longitude = e.currentTarget.dataset.longitude
    console.log("latitude:", latitude)
    console.log("longitude:", longitude)
    wx.openLocation({
      latitude: Number(latitude),
      longitude: Number(longitude),
    })
  }
 However, when it is written into onload, it is invalid.

If you have any questions, please join the group: 563752274 , the pure applet development exchange group, answer the question answer: Tony .

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325349629&siteId=291194637