UNPKG

@vuemap/vue-amap

Version:

高德地图vue3版本封装

89 lines (84 loc) 2.41 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var vue = require('vue'); require('../../../../mixins/index.js'); var buildHelper = require('../../../../utils/buildHelper.js'); var VideoLayer = require('./VideoLayer.js'); var useRegister = require('../../../../mixins/useRegister.js'); var script = /* @__PURE__ */ vue.defineComponent({ ...{ name: "ElAmapLayerVideo", inheritAttrs: false }, __name: "Video", props: buildHelper.buildProps({ url: { required: true, type: String }, // 视频地址 zooms: { type: Array }, // 支持的缩放级别范围,默认范围 [2-30] bounds: { type: [Array, Object] }, // 图片的范围大小经纬度,如果传递数字数组类型: [minlng,minlat,maxlng,maxlat] 或 AMap.Bounds opacity: { type: Number } // 透明度,默认 1 }), emits: ["init"], setup(__props, { expose: __expose, emit: __emit }) { const emits = __emit; const videoRef = vue.ref(); let $amapComponent; const { $$getInstance, parentInstance } = useRegister.useRegister((options, parentComponent) => { return new Promise((resolve) => { $amapComponent = new VideoLayer.default(options, videoRef.value); parentComponent.addLayer($amapComponent.getLayer()); resolve($amapComponent); }); }, { emits, destroyComponent() { if ($amapComponent && (parentInstance == null ? void 0 : parentInstance.$amapComponent)) { if (!(parentInstance == null ? void 0 : parentInstance.isDestroy)) { $amapComponent.destroy(); parentInstance == null ? void 0 : parentInstance.$amapComponent.removeLayer($amapComponent.getLayer()); } $amapComponent = null; } } }); const $$play = () => { $amapComponent.play(); }; const $$pause = () => { $amapComponent.pause(); }; __expose({ $$getInstance, $$play, $$pause }); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock( "video", { ref_key: "videoRef", ref: videoRef, style: { "display": "none" }, muted: "" }, null, 512 /* NEED_PATCH */ ); }; } }); exports.default = script; //# sourceMappingURL=Video.vue2.js.map