1 line
1.9 KiB
JavaScript
1 line
1.9 KiB
JavaScript
|
"use strict";(self["webpackChunkscui"]=self["webpackChunkscui"]||[]).push([[8273],{869:function(e,t,n){n.r(t),n.d(t,{default:function(){return h}});var i=n(641);const a={style:{"line-height":"1.5","font-size":"13px"}},l=(0,i.Lk)("p",null,"演示了使用 @/utils/load 加载百度地图的JSAPI和它的GL库BMapGLLib",-1),o=(0,i.Lk)("p",null,"当然也可以像传统网页一样加载任何JS和CSS,甚至可以是JQ。",-1),d=(0,i.Lk)("br",null,null,-1),r=(0,i.Lk)("div",{style:{width:"100%",height:"100%"},id:"container"},null,-1);function u(e,t,n,u,c,s){const p=(0,i.g2)("el-alert"),w=(0,i.g2)("el-card"),h=(0,i.g2)("el-aside"),k=(0,i.g2)("el-main"),b=(0,i.g2)("el-container");return(0,i.uX)(),(0,i.Wv)(b,null,{default:(0,i.k6)((()=>[(0,i.bF)(h,{style:{padding:"15px",width:"400px"}},{default:(0,i.k6)((()=>[(0,i.bF)(w,{shadow:"never",header:"异步加载JS"},{default:(0,i.k6)((()=>[(0,i.Lk)("div",a,[l,o,d,(0,i.bF)(p,{title:"这是一项试验工具, 具有不稳定性",type:"warning","show-icon":"",closable:!1})])])),_:1})])),_:1}),(0,i.bF)(k,{class:"nopadding"},{default:(0,i.k6)((()=>[r])),_:1})])),_:1})}function c(e,t,n){return new Promise(((i,a)=>{let l=document.head.querySelector("script[loadKey="+t+"]");if(l)return i(window[t]);let o=document.createElement("script");o.type="text/javascript",o.src=e,o.setAttribute("loadKey",t),document.head.appendChild(o),o.onload=()=>{n?window[n]=()=>i(window[t]):setTimeout((()=>i(window[t])),50)},o.onerror=e=>a(e)}))}var s={name:"loadJS",data(){return{}},mounted(){this.init()},methods:{async init(){var e="vxSbZuydZ42ktZCvXvy5xCai28OEVqUq",t=await c(`//api.map.baidu.com/api?type=webgl&v=1.0&ak=${e}&callback=BMapGLinit`,"BMapGL","BMapGLinit"),n=new t.Map("container");n.centerAndZoom(new t.Point(116.297611,40.047363),20),n.enableScrollWheelZoom(),n.setTilt(55),n.setDisplayOptions({poiText:!1,poiIcon:!1})}}},p=n(6262);const w=(0,p.A)(s,[["render",u]]);var h=w}}]);
|