<template>
  <div>
    <div>地理围栏</div>
    <a-map-polyline ref="polyline"></a-map-polyline>
    <el-button type="primary" @click="getPath()">获取路径</el-button>
    <div>{{ path }}</div>
  </div>
</template>


<script>
import AMapPolyline from "@/components/AMap/AMapPolyline"

export default {
  name: "polyline",
  components: {AMapPolyline},
  data() {
    return {
      path: undefined, // 路径
    }
  },

  mounted() {
    // 设置电子围栏
    this.$nextTick(() => {
      this.$refs.polyline.setPath(JSON.parse("[[113.308355,23.218915],[113.332911,23.209449],[113.330508,23.143962],[113.312818,23.161955]]"))
    })
  },

  methods: {
    // 获取地图围栏
    getPath() {
      this.path = this.$refs.polyline && this.$refs.polyline.getPath();
    }
  }
}
</script>

<style scoped>
.input {
  width: 320px;
  height: auto;
}

.map {
  height: 400px;
  width: 800px;
}
</style>
