UNPKG

@vuemap/vue-amap

Version:

高德地图vue3版本封装

86 lines (81 loc) 2.38 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var vue = require('vue'); require('../../../../mixins/index.js'); var buildHelper = require('../../../../utils/buildHelper.js'); require('../../../../utils/index.js'); var useRegister = require('../../../../mixins/useRegister.js'); var util = require('../../../../utils/util.js'); var script = /* @__PURE__ */ vue.defineComponent({ ...{ name: "ElAmapLayerTiles3d", inheritAttrs: false }, __name: "Tiles3D", props: buildHelper.buildProps({ url: { type: String, required: true }, threeScriptUrl: { type: String, default: "//a.amap.com/jsapi_demos/static/data3d/lib/three.117.js" }, threeGltfLoader: { type: String, default: "//a.amap.com/jsapi_demos/static/data3d/lib/GLTFLoader.117.min.js" }, layerStyle: { type: Object } }), emits: ["init"], setup(__props, { expose: __expose, emit: __emit }) { const emits = __emit; let $amapComponent; const { $$getInstance, parentInstance } = useRegister.useRegister((options, parentComponent) => { return new Promise((resolve) => { parentComponent.plugin(["AMap.3DTilesLayer"], () => { if (!window["THREE"]) { util.loadScript(options.threeScriptUrl, () => { util.loadScript(options.threeGltfLoader, () => { createLayer(options); resolve($amapComponent); }); }); } else { createLayer(options); resolve($amapComponent); } }); }); }, { emits, destroyComponent() { if ($amapComponent) { $amapComponent = null; } } }); const createLayer = (options) => { let layerStyle = {}; if (options.layerStyle) { layerStyle = JSON.parse(JSON.stringify(options.layerStyle)); } $amapComponent = new AMap["3DTilesLayer"]({ map: parentInstance == null ? void 0 : parentInstance.$amapComponent, url: options.url, // 3d Tiles 入口文件 style: layerStyle }); }; __expose({ $$getInstance }); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div"); }; } }); exports.default = script; //# sourceMappingURL=Tiles3D.vue2.js.map