日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > vue >内容正文

vue

vue传中文标点_vue项目引入第三方高德地图实现标点定位

發布時間:2023/12/10 vue 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 vue传中文标点_vue项目引入第三方高德地图实现标点定位 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

vue項目中,高德地圖使用。

引入vue中。異步導入vue中。

gaoDe(key) {

window.onApiLoaded = function () {

var map = new AMap.Map('container', {

resizeEnable: true,

center: [113.951955, 22.530825],

zoom: 16

});

}

var url = `https://webapi.amap.com/maps? v=1.4.15&key=${key}&callback=onApiLoaded`;

var jsapi = document.createElement('script');

jsapi.charset = 'utf-8';

jsapi.src = url;

document.head.appendChild(jsapi);

mounted() {

this.gaoDe('key');

},

在vue組件中使用,直接寫在mouted中會出現AMap未定義的報錯!

目前,個人是使用定時器解決的。

// 地圖接口API

mapCom() {

let _this = this;

window.onLoad = function () {

var map = new AMap.Map('mapBox', {

resizeEnable: true,

center: [113.951955, 22.530825],

zoom: 16

});

// console.log( _this.mapArray);

// 渲染坐標

// console.log(_this.status==false)

setTimeout(() => {

if (_this.status == false) {

return;

}

// console.log(_this.mapArray);

_this.mapArray.forEach(item => {

// console.log(item)

var marker = new AMap.Marker({

map: map,

icon: "//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",

position: item,

offset: new AMap.Pixel(-10, -30)

});

})

}, 1000)

// console.log(_this.mapArray);

map.plugin(["AMap.ToolBar"], function () {

map.addControl(new AMap.ToolBar());

});

}

var url = `https://webapi.amap.com/maps?v=1.4.15&key=91d89e79a544b9ab37aa0147aec9bd0a&callback=onLoad`;

var jsapi = document.createElement('script');

jsapi.charset = 'utf-8';

jsapi.src = url;

document.head.appendChild(jsapi);

},

總結

以上是生活随笔為你收集整理的vue传中文标点_vue项目引入第三方高德地图实现标点定位的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。