小程序選擇地圖


小程序wx.chooseLocation地圖選點確認地址

  /**
   * 生命周期函數--監聽頁面加載
   */
  onLoad: function (options) {
    console.log(options);
    if (options.jumpUrl){
      wx.chooseLocation({
        success: function (res) {
          let str = `${options.jumpUrl}&latitude=${res.latitude}&longitude=${res.longitude}&address=${res.address}`
          wx.redirectTo({
            url: `../../webView/webView?s=map&str=${encodeURIComponent(str)}`
          })
        }
      })
    }
  },

  前沿 :小程序選擇地圖,上述功能是別的頁面進來會傳url地址,onLoad函數

wx.chooseLocation 選擇后會有經度緯度,和詳細地址參數,返回給webView頁面,並把參數放在str 對應上。
 
        
 
        

一、微信小程序位置接口wx.chooseLocation

本接口使用簡單,用戶用戶通過騰訊地圖選擇一個位置。

本接口能獲得選擇位置的簡稱,全稱,以及坐標。

    //選擇地址
    wx.chooseLocation({
      success: function(res) {
        console.info(res);
      },
    })

  

 

 

 
        

 

 
        

 

容易混淆的接口wx.chooseAddress 本接口用於獲取用戶的收獲地址信息。

官方API參考

 
        
 
       


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM