vue 页面添加script 标签引入js
mounted() {// AMapUI.loadUI(...)this.init ();},methods: {init () {let script = document.getElementById('gaodeMapScript');// if(this.map) return;// this.isBodyLoading = true;if(!script){script = docume
·
mounted() {
// AMapUI.loadUI(...)
this.init ();
},
methods: {
init () {
let script = document.getElementById('gaodeMapScript');
// if(this.map) return;
// this.isBodyLoading = true;
if(!script){
script = document.createElement('script');
script.id = 'gaodeMapScript';
script.src = 'https://webapi.amap.com/maps?v=1.4.15&key=5646';
document.body.append(script);
script.addEventListener('load',e =>{
setTimeout(this.marker,500);
})
}else{
this.marker();
}
}
}
更多推荐
已为社区贡献4条内容
所有评论(0)