xy-map 1.0.36 → 1.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xy-map",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
4
4
  "description": "地图组件",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -98,7 +98,7 @@ export default {
98
98
  })
99
99
  },
100
100
  draw () {
101
- if (this.pointList) {
101
+ if (this.pointList && this.pointList.length > 0) {
102
102
  let features = this.pointList.map(item => {
103
103
  return {
104
104
  'type': 'Feature',
@@ -119,15 +119,16 @@ export default {
119
119
  this.drawUpdate(this.geoJson, true)
120
120
  this.edit()
121
121
  },
122
- edit () {
123
- // 开启编辑
122
+ edit () { // 开启编辑
123
+ if (this.geoJson.features.length === 0) return
124
124
  this.geoJson.features.forEach(item => {
125
125
  this.$refs.draw.drawEdit(item.geometry)
126
126
  })
127
127
  },
128
128
  drawUpdate (data, autoZoom = false) {
129
+ if (!data) return
129
130
  this.geoJson = data
130
- this.position = this.geoJson.features.map(item => item.geometry.coordinates)
131
+ this.position = data.features.map(item => item.geometry.coordinates)
131
132
 
132
133
  if (this.autoZoom || autoZoom) { // 开启缩放动画
133
134
  this.$nextTick(() => {
@@ -98,7 +98,7 @@ export default {
98
98
  })
99
99
  },
100
100
  draw () {
101
- if (this.pointList) {
101
+ if (this.pointList && this.pointList.length > 0) {
102
102
  let features = this.pointList.map(item => {
103
103
  return {
104
104
  'type': 'Feature',
@@ -119,13 +119,14 @@ export default {
119
119
  this.drawUpdate(this.geoJson, true)
120
120
  this.edit()
121
121
  },
122
- edit () {
123
- // 开启编辑
122
+ edit () { // 开启编辑
123
+ if (this.geoJson.features.length === 0) return
124
124
  this.geoJson.features.forEach(item => {
125
125
  this.$refs.draw.drawEdit(item.geometry)
126
126
  })
127
127
  },
128
128
  drawUpdate (data, autoZoom = false) {
129
+ if (!data) return
129
130
  this.geoJson = data
130
131
  this.position = data.features.map(item => item.geometry.coordinates[0])
131
132