Pārlūkot izejas kodu

update PhotoMap.vue

reghao 7 mēneši atpakaļ
vecāks
revīzija
15aeb54943
1 mainītis faili ar 12 papildinājumiem un 10 dzēšanām
  1. 12 10
      src/views/map/PhotoMap.vue

+ 12 - 10
src/views/map/PhotoMap.vue

@@ -42,7 +42,7 @@
               :events="mapEvents"
             >
               <el-amap-marker
-                v-for="(marker, index) in markers"
+                v-for="(marker, index) in marks"
                 :key="index"
                 :position="marker.position"
                 :label="marker.label"
@@ -142,7 +142,7 @@ export default {
       mapCenter: [114.0000, 30.0000],
       // zoom=6 的比例尺为 100km
       zoom: 6,
-      markers: [],
+      marks: [],
       markerEvents: {
         click: (e) => {
           const id = e.target.getExtData().id
@@ -209,7 +209,7 @@ export default {
       lazyAMapApiLoaderInstance.load().then(() => {
         // 图标样式
         var styleObject = {
-          url: '//webapi.amap.com/theme/v1.3/markers/n/mark_b.png', // 图标地址
+          url: '//webapi.amap.com/theme/v1.3/marks/n/mark_b.png', // 图标地址
           size: new AMap.Size(11, 11), // 图标大小
           anchor: new AMap.Pixel(5, 5) // 图标显示位置偏移量,基准点为图标左上角
         }
@@ -247,9 +247,9 @@ export default {
             duration: 1000
           })
 
-          this.markers = []
+          this.marks = []
           for (const item of res.data) {
-            this.markers.push({
+            this.marks.push({
               position: [item.position.lng, item.position.lat],
               label: { content: item.title, offset: [0, 0] },
               extData: { id: item.id }
@@ -281,7 +281,7 @@ export default {
             duration: 1000
           })
 
-          this.markers = []
+          this.marks = []
           const massMarkers = []
           for (const item of res.data) {
             massMarkers.push({
@@ -332,6 +332,7 @@ export default {
     onSelectChange() {
       this.cascaderOption = []
       if (this.selectedOption === '') {
+        this.marks = []
         this.$message.error('请先选择标签')
         return
       }
@@ -342,6 +343,7 @@ export default {
       this.selectedOption = ''
       const length = val.length
       if (length === 0) {
+        this.marks = []
         this.$message.error('请先选择地区')
         return
       }
@@ -355,9 +357,9 @@ export default {
             duration: 1000
           })
 
-          this.markers = []
+          this.marks = []
           for (const item of res.data) {
-            this.markers.push({
+            this.marks.push({
               position: [item.position.lng, item.position.lat],
               label: { content: item.title, offset: [0, 0] },
               extData: { id: item.id }
@@ -405,9 +407,9 @@ export default {
           this.amap.setCenter(this.mapCenter)
           this.amap.setZoom(this.zoom)
 
-          this.markers = []
+          this.marks = []
           for (const item of res.data) {
-            this.markers.push({
+            this.marks.push({
               position: [item.position.lng, item.position.lat],
               label: { content: item.title, offset: [0, 0] },
               extData: { id: item.id }