feat
This commit is contained in:
parent
4be3c6bc11
commit
67f0284918
@ -33,7 +33,7 @@ initAMapApiLoader({
|
||||
AMapUI: {
|
||||
plugins: ['misc/PathSimplifier'],
|
||||
},
|
||||
plugins: ['AMap.MapType'],
|
||||
plugins: ['AMap.MapType', 'AMap.DistrictSearch'],
|
||||
});
|
||||
|
||||
const app = createApp(App);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="plant-gs-warp">
|
||||
<div ref="viewwarp" class="plant-gs-content" :style="{ 'background-image': 'url(' + getAssetsFile('images/plant/bg1.png') + ')' }">
|
||||
<el-amap :zoom="11" :center="[99.402267, 23.538889]" ref="mapRef">
|
||||
<el-amap ref="mapRef" :zoom="11" :center="[99.402267, 23.538889]" :mask="yunnan" view-mode="3D" @init="initMap">
|
||||
<!-- 带孔洞的四边形 -->
|
||||
<el-amap-layer-satellite :visible="visible" />
|
||||
<el-amap-polygon :path="polygon" :fill-opacity="0.5" fill-color="#748cb7" stroke-color="transparent" />
|
||||
@ -13,6 +13,7 @@
|
||||
import { isEmpty, getAssetsFile } from '@/utils';
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import { ElAmap, ElAmapPolygon } from '@vuemap/vue-amap';
|
||||
import { ElAmapLoca, ElAmapLocaHeatmap } from '@vuemap/vue-amap-loca';
|
||||
onMounted(() => {});
|
||||
|
||||
const zoom = ref(15);
|
||||
@ -33,7 +34,23 @@ const polygon = reactive([
|
||||
]);
|
||||
|
||||
const mapRef = ref(null);
|
||||
onMounted(() => {});
|
||||
const yunnan = ref([]);
|
||||
function initMap(e) {
|
||||
var opts = {
|
||||
subdistrict: 0,
|
||||
extensions: 'all',
|
||||
level: 'province',
|
||||
};
|
||||
var district = new AMap.DistrictSearch(opts);
|
||||
district.search('云南省', function (status, result) {
|
||||
console.log('res', result);
|
||||
var bounds = result.districtList[0].boundaries;
|
||||
for (var i = 0; i < bounds.length; i += 1) {
|
||||
yunnan.value.push([bounds[i]]);
|
||||
}
|
||||
console.log('mask.value', yunnan.value);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.plant-gs-warp {
|
||||
|
Loading…
x
Reference in New Issue
Block a user