{"version":3,"sources":["webpack:///./src/components/Maps/BMap/Control.js","webpack:///./src/components/Maps/mapUtils.js"],"names":["mixins","Base","props","render","h","this","$slots","default","data","instance","beforeDestroy","map","removeControl","methods","load","_this","control","defaultAnchor","window","BMAP_ANCHOR_TOP_LEFT","defaultOffset","BMap","Size","prototype","Control","initialize","getContainer","appendChild","$el","addControl","loadScript","src","cb","addSign","scripts","document","getElementsByTagName","i","length","indexOf","cbName","concat","Date","getTime","$script","createElement","setAttribute","item","inject","computed","getMap","created","watch","val"],"mappings":"kHAAA,uBAGe,cACbA,OAAQ,CAACC,QACTC,MAAO,GACPC,OAAM,SAACC,GACL,OAAOA,EAAE,MAAO,GAAIC,KAAKC,OAAOC,UAElCC,KAAI,WACF,MAAO,CACLC,SAAU,OAGdC,cAAa,WACPL,KAAKM,KAAON,KAAKI,UACnBJ,KAAKM,IAAIC,cAAcP,KAAKI,WAGhCI,QAAS,CACPC,KAAI,WAAG,IAAAC,EAAA,KACL,SAASC,IACPX,KAAKY,cAAgBC,OAAOC,qBAC5Bd,KAAKe,cAAgB,IAAIF,OAAOG,KAAKC,KAAK,EAAG,GAE/CN,EAAQO,UAAY,IAAIL,OAAOG,KAAKG,QACpCR,EAAQO,UAAUE,WAAa,SAAAd,GAAG,OAChCA,EAAIe,eAAeC,YAAYZ,EAAKa,MACtCvB,KAAKI,SAAW,IAAIO,EACpBX,KAAKM,IAAIkB,WAAWxB,KAAKI,c,kCCpBxB,SAASqB,EAAWC,EAAKC,GAG9B,IAFA,IAAIC,GAAU,EACVC,EAAUC,SAASC,qBAAqB,UACnCC,EAAI,EAAGA,EAAIH,EAAQI,OAAQD,IAC9BH,EAAQG,IAAMH,EAAQG,GAAGN,MAAuC,GAAhCG,EAAQG,GAAGN,IAAIQ,QAAQR,KACzDE,GAAU,GAGd,GAAIA,EAAS,CACX,IAAIO,EAAS,MAAHC,QAAS,IAAIC,MAAOC,WAC9BzB,OAAOsB,GAAU,kBACRtB,OAAOsB,GACdR,KAEFD,EAAM,GAAHU,OAAMV,EAAG,cAAAU,OAAaD,GACzB,IAAII,EAAUT,SAASU,cAAc,UACrCD,EAAQE,aAAa,OAAQ,mBAC7BF,EAAQE,aAAa,MAAOf,GAC5Ba,EAAQE,aAAa,QAAS,IAC9BF,EAAQE,aAAa,QAAS,IAC9BX,SACGC,qBAAqB,QACrBW,KAAK,GACLpB,YAAYiB,QAEfZ,IAlCJ,oEAyCO,IAAM/B,EAAO,CAClB+C,OAAQ,CAAC,UACTxC,KAAI,WACF,MAAO,CACLC,SAAU,OAGdwC,SAAU,CACRtC,IAAG,WACD,OAAON,KAAK6C,WAGhBC,QAAO,WACD9C,KAAKM,KACPN,KAAKS,QAGTsC,MAAO,CACLzC,IAAG,SAAC0C,GACEA,GACFhD,KAAKS,SAIXD,QAAS,CACPC,KAAI","file":"js/chunk-0209ee78.88d68182.js","sourcesContent":["import {\n Base\n} from \"../mapUtils\";\nexport default {\n mixins: [Base],\n props: {},\n render(h) {\n return h('div', {}, this.$slots.default)\n },\n data() {\n return {\n instance: null\n };\n },\n beforeDestroy() {\n if (this.map && this.instance) {\n this.map.removeControl(this.instance);\n }\n },\n methods: {\n load() {\n function control() {\n this.defaultAnchor = window.BMAP_ANCHOR_TOP_LEFT;\n this.defaultOffset = new window.BMap.Size(0, 0);\n }\n control.prototype = new window.BMap.Control();\n control.prototype.initialize = map =>\n map.getContainer().appendChild(this.$el);\n this.instance = new control();\n this.map.addControl(this.instance);\n }\n }\n};","export function removeScript(src) {\n var scripts = document.getElementsByTagName(\"script\");\n for (var i = 0; i < scripts.length; i++) {\n if (scripts[i] && scripts[i].src && scripts[i].src.indexOf(src) != -1) {\n scripts[i].parentNode.removeChild(scripts[i]);\n }\n }\n}\n\nexport function loadScript(src, cb) {\n var addSign = true;\n var scripts = document.getElementsByTagName(\"script\");\n for (var i = 0; i < scripts.length; i++) {\n if (scripts[i] && scripts[i].src && scripts[i].src.indexOf(src) != -1) {\n addSign = false;\n }\n }\n if (addSign) {\n let cbName = `cb_${new Date().getTime()}`;\n window[cbName] = function () {\n delete window[cbName];\n cb();\n };\n src = `${src}&callback=${cbName}`;\n var $script = document.createElement(\"script\");\n $script.setAttribute(\"type\", \"text/javascript\");\n $script.setAttribute(\"src\", src);\n $script.setAttribute(\"async\", '');\n $script.setAttribute(\"defer\", '');\n document\n .getElementsByTagName(\"head\")\n .item(0)\n .appendChild($script);\n } else {\n cb();\n }\n}\n\n/**\n * 地图组件基类\n */\nexport const Base = {\n inject: [\"getMap\"],\n data() {\n return {\n instance: null\n }\n },\n computed: {\n map() {\n return this.getMap();\n }\n },\n created() {\n if (this.map) {\n this.load();\n }\n },\n watch: {\n map(val) {\n if (val) {\n this.load();\n }\n }\n },\n methods: {\n load() {}\n }\n}"],"sourceRoot":""}