简易版绘制围栏
<template>
<div class="amapContainer_con">
<button type="primary" @click="drawArea">绘制多边形区域</button>
<button type="primary" @click="removeArea">清空区域</button>
<button type="primary" @click="onSubmit">确定</button>
<div id="container"></div>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
</div>
</template>
<script>
import AMapLoader from '@amap/amap-jsapi-loader'
export default {
name: 'stateMap',
data() {
return {
map: null,
path: [],
polygonItem: [],
bouncedShow: {
isShow: true,
},
packUpShow: false,
polygons: '',
webList: [],
polygoneee: null,
}
},
mounted() {
this.initMap()
},
destroyed() {
this.map.destroy()
},
methods: {
initMap() {
window._AMapSecurityConfig = {
securityJsCode: 'xxx',
}
AMapLoader.load({
key: 'xxx',
version: '1.4.15',
plugins: [
'AMap.PolyEditor',
'AMap.ToolBar',
'AMap.MouseTool',
'AMap.ControlBar',
'AMap.Scale',
'AMap.serviceNames',
'AMap.Autocomplete&