小程序接地图

原创 tigon  2021-08-16 09:35:20  阅读 141 次 评论 0 条

longitude latitude是中心经纬度
markers 是所有打点的经纬度,微信地图也是包了高德地图

<map wx:if="{{mapShow}}" class="map" id="map"  scale="{{scale}}" bindregionchange="moveMapFn"  bindanchorpointtap="bindanchorpointtapFn" bindcallouttap="bindcallouttapFn" longitude="{{longitude}}" bindmarkertap="bindmarkertapFn" latitude="{{latitude}}" markers="{{markers}}">
      <view class="cover-view">
          <view class="container">
            <view class="flex-wrp" style="flex-direction:row;">
              <image class="center_point"  src="../../resources/images/map/current_location.png"></image>
            </view>
          </view>
        </view>
    </map>

let that = this;
    let keywords = e.detail.value; 
    console.log(keywords)
    let key = getApp().globalData.mapSDK;
    console.log(key)

    let myAmapFun = new amapFile.AMapWX({key: key});
    myAmapFun.getInputtips({
      city:this.data.city_name,
      keywords: keywords,
      // location: '40.22077,116.23128',
      success: function(data){
        if(data && data.tips){
          let tipsData=JSON.parse(JSON.stringify(data.tips))
          for(let i=0;i<tipsData.length;i++){
            tipsData[i].name=tipsData[i].name.replace(new RegExp(keywords, 'g'),`<span style="color:#64B5FF">${keywords}</span>`)
          }
          console.log(tipsData)
          that.setData({
            tips: tipsData,
            tipsData:data.tips,
            isstart:false
          });
          console.log(data.tips)

        }

      }
    })
本文地址:https://webge.net/?id=129
版权声明:本文为原创文章,版权归 tigon 所有,欢迎分享本文,转载请保留出处!

评论已关闭!