UNPKG

@vuemap/vue-amap

Version:

高德地图vue3版本封装

93 lines (88 loc) 3.02 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var vue = require('vue'); require('../../../../mixins/index.js'); var buildHelper = require('../../../../utils/buildHelper.js'); var useRegister = require('../../../../mixins/useRegister.js'); var script = /* @__PURE__ */ vue.defineComponent({ ...{ name: "ElAmapLayerDistrict", inheritAttrs: false }, __name: "DistrictLayer", props: buildHelper.buildProps({ type: { type: String, default: "Country", validator: (value) => { return ["World", "Country", "Province"].indexOf(value) !== -1; } }, adcode: { type: String }, // 行政区的编码 adcode与省市行政区对照表,下载地址:https://a.amap.com/lbs/static/file/AMap_adcode_citycode.xlsx.zip SOC: { type: String }, // 设定显示的国家,对应下载地址: https://a.amap.com/jsapi_demos/static/demo-center/js/soc-list.json depth: { type: Number }, // 设定数据的层级深度,depth为0的时候只显示国家面,depth为1的时候显示省级, 当国家为中国时设置depth为2的可以显示市一级 zooms: { type: Array }, // 支持的缩放级别范围,默认范围 [2-30] opacity: { type: Number }, // 透明度,默认 1 styles: { type: Object } // 为简易行政区图设定各面的填充颜色和描边颜色。 styles各字段的值可以是颜色值,也可以是一个返回颜色值* 的回调函数function。 }), emits: ["init"], setup(__props, { expose: __expose, emit: __emit }) { const props = __props; const emits = __emit; let $amapComponent; const { $$getInstance, parentInstance } = useRegister.useRegister((options, parentComponent) => { return new Promise((resolve) => { if (props.type === "World") { $amapComponent = new AMap.DistrictLayer.World(options); } else if (props.type === "Country") { $amapComponent = new AMap.DistrictLayer.Country(options); } else if (props.type === "Province") { $amapComponent = new AMap.DistrictLayer.Province(options); } parentComponent.add($amapComponent); resolve($amapComponent); }); }, { emits, watchRedirectFn: { __SOC(value) { $amapComponent.setSOC(value); } }, destroyComponent() { if ($amapComponent && (parentInstance == null ? void 0 : parentInstance.$amapComponent)) { if (!(parentInstance == null ? void 0 : parentInstance.isDestroy)) { parentInstance == null ? void 0 : parentInstance.$amapComponent.remove($amapComponent); } $amapComponent = null; } } }); __expose({ $$getInstance }); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock("div"); }; } }); exports.default = script; //# sourceMappingURL=DistrictLayer.vue2.js.map