宅男在线永久免费观看网直播,亚洲欧洲日产国码无码久久99,野花社区在线观看视频,亚洲人交乣女bbw,一本一本久久a久久精品综合不卡

全部
常見(jiàn)問(wèn)題
產(chǎn)品動(dòng)態(tài)
精選推薦

高德地圖實(shí)現(xiàn)點(diǎn)擊地圖添加標(biāo)記,通過(guò)輸入框搜索詳細(xì)地址自動(dòng)定位到指定位置

管理 管理 編輯 刪除

高德地圖api版本:JavaScript API V2.0.05dd9320230727101316981.png

用高德地圖實(shí)現(xiàn)輸入搜索地址 添加標(biāo)記,鼠標(biāo)移動(dòng)標(biāo)記來(lái)獲取當(dāng)前該點(diǎn)的經(jīng)緯度,詳細(xì)地址

1. 高德地圖的頁(yè)面構(gòu)建:首先先引入高德地圖,增加自己想要的功能,我們這里需要一個(gè)輸入聯(lián)想框

944ba202307271017038938.png

2. 高德地圖的Api來(lái)實(shí)現(xiàn)相關(guān)功能

1. 構(gòu)建地圖

  initMap() {
      const that = this
      return new Promise((reslove, reject) => {
        AMapLoader.load({
          key: 'cf5c437b14780406af75a81b380cafac',
          version: '2.0',
          plugins: [
            'AMap.ToolBar',
            'AMap.Scale',
            'AMap.Geocoder',
            'AMap.Geolocation',
            'AMap.PlaceSearch',
            'AMap.AutoComplete',
            'AMap.CitySearch'
          ],
          resizeEnable: true
        }).then((AMap) => {
          that.map = new AMap.Map('allmap', {
            resizeEnable: true,
            zoom: 14,
            viewMode: '3D', //使用3D視圖
            center: [that.positionInfo.lng, that.positionInfo.lat]
          })
          that.getCurrentLocation()
          that.map.addControl(new AMap.Scale()) // 在圖面添加比例尺控件,展示地圖在當(dāng)前層級(jí)和緯度下的比例尺
          that.map.addControl(new AMap.ToolBar()) //在圖面添加鷹眼控件,在地圖右下角顯示地圖的縮略圖
          that.geocoder = new AMap.Geocoder({ radius: 1000, extensions: 'all', city: '全國(guó)' })
          that.mapSearchInit()
          that.geocoder.getAddress([that.positionInfo.lng, that.positionInfo.lat], function (status, result) {
            if (status === 'complete' && result.regeocode) {
              that.address = result.regeocode.formattedAddress
            } else {
              that.$message.error('根據(jù)經(jīng)緯度查詢(xún)地址失敗')
            }
          })
        })
      })
    },


2. 根據(jù)輸入框內(nèi)容搜索地點(diǎn),經(jīng)緯度

  searchKeyWord() {
      let that = this
      that.placeSearchComponent.search(that.address, function (status, result) {
        if (status === 'complete' && result.info === 'OK') {
          that.show = true
          // 關(guān)鍵字聯(lián)想的選項(xiàng)內(nèi)容
          that.poiList = result.poiList.pois
        } else {
          that.showsearchResult = false
          that.poiList = []
          that.$message({
            message: '沒(méi)有查到結(jié)果',
            type: 'warning'
          })
        }
      })
    },

3. 動(dòng)態(tài)設(shè)置點(diǎn)標(biāo)記,構(gòu)造矢量圓形

 dynamicSign(lng, lat, radius) {
      var marker = new AMap.Marker({
        position: new AMap.LngLat(lng, lat), //參數(shù)為經(jīng)緯度
        draggable: true,
        cursor: 'move',
        riseOnHover: true,
        bubble: true,
        cursor: 'pointer'
      })
      // 構(gòu)造矢量圓形
      const circle = new AMap.Circle({
        center: new AMap.LngLat(lng, lat), // 圓心位置
        radius: radius, //半徑
        strokeColor: '#1890ff', //線顏色
        strokeOpacity: 1, //線透明度
        strokeWeight: 1, //線粗細(xì)度
        fillColor: '#1890ff', //填充顏色
        fillOpacity: 0.35 //填充透明度
      })
      this.map.clearMap()
      this.map.add([marker, circle]) // 添加點(diǎn)標(biāo)志
      marker.on('dragend', this.markerClick)
    },

 高德地圖api接口比較豐富,大多的需求都能實(shí)現(xiàn)。本次主要使用了POI搜索插件AMap.PlaceSearch,獲取城市信息AMap.getCityInfo,設(shè)置標(biāo)記點(diǎn)AMap.Marker,構(gòu)造矢量圖AMap.Circle結(jié)合了帶列表的POI搜索的這個(gè),再將監(jiān)聽(tīng)事件改為列表點(diǎn)選的selectChange事件,獲得當(dāng)前點(diǎn)選地點(diǎn)經(jīng)緯度,這樣將二者進(jìn)行了組合一下實(shí)現(xiàn)了以上的搜索以及展現(xiàn)方式。


請(qǐng)登錄后查看

怎么網(wǎng)名又被占用了 最后編輯于2023-07-27 10:34:20

快捷回復(fù)
回復(fù)
回復(fù)
回復(fù)({{post_count}}) {{!is_user ? '我的回復(fù)' :'全部回復(fù)'}}
排序 默認(rèn)正序 回復(fù)倒序 點(diǎn)贊倒序

{{item.user_info.nickname ? item.user_info.nickname : item.user_name}} LV.{{ item.user_info.bbs_level }}

作者 管理員 企業(yè)

{{item.floor}}# 同步到gitee 已同步到gitee {{item.is_suggest == 1? '取消推薦': '推薦'}}
{{item.is_suggest == 1? '取消推薦': '推薦'}}
沙發(fā) 板凳 地板 {{item.floor}}#
{{item.user_info.title || '暫無(wú)簡(jiǎn)介'}}
附件

{{itemf.name}}

{{item.created_at}}  {{item.ip_address}}
打賞
已打賞¥{{item.reward_price}}
{{item.like_count}}
{{item.showReply ? '取消回復(fù)' : '回復(fù)'}}
刪除
回復(fù)
回復(fù)

{{itemc.user_info.nickname}}

{{itemc.user_name}}

回復(fù) {{itemc.comment_user_info.nickname}}

附件

{{itemf.name}}

{{itemc.created_at}}
打賞
已打賞¥{{itemc.reward_price}}
{{itemc.like_count}}
{{itemc.showReply ? '取消回復(fù)' : '回復(fù)'}}
刪除
回復(fù)
回復(fù)
查看更多
打賞
已打賞¥{{reward_price}}
8377
{{like_count}}
{{collect_count}}
添加回復(fù) ({{post_count}})

相關(guān)推薦

快速安全登錄

使用微信掃碼登錄
{{item.label}} 加精
{{item.label}} {{item.label}} 板塊推薦 常見(jiàn)問(wèn)題 產(chǎn)品動(dòng)態(tài) 精選推薦 首頁(yè)頭條 首頁(yè)動(dòng)態(tài) 首頁(yè)推薦
取 消 確 定
回復(fù)
回復(fù)
問(wèn)題:
問(wèn)題自動(dòng)獲取的帖子內(nèi)容,不準(zhǔn)確時(shí)需要手動(dòng)修改. [獲取答案]
答案:
提交
bug 需求 取 消 確 定
打賞金額
當(dāng)前余額:¥{{rewardUserInfo.reward_price}}
{{item.price}}元
請(qǐng)輸入 0.1-{{reward_max_price}} 范圍內(nèi)的數(shù)值
打賞成功
¥{{price}}
完成 確認(rèn)打賞

微信登錄/注冊(cè)

切換手機(jī)號(hào)登錄

{{ bind_phone ? '綁定手機(jī)' : '手機(jī)登錄'}}

{{codeText}}
切換微信登錄/注冊(cè)
暫不綁定
CRMEB客服

CRMEB咨詢(xún)熱線 咨詢(xún)熱線

400-8888-794

微信掃碼咨詢(xún)

CRMEB開(kāi)源商城下載 源碼下載 CRMEB幫助文檔 幫助文檔
返回頂部 返回頂部
CRMEB客服