Newer
Older
smartwell_front / src / components / Amap / mixins / editor-component.js
StephanieGitHub on 16 May 2022 544 bytes feat<components>: 新增AMapMarker组件
import eventHelper from '../utils/event-helper'
export default {
  methods: {
    setEditorEvents() {
      if (!this.$amapComponent.editor || !this.events) return
      const filters = ['addnode', 'adjust', 'removenode', 'end', 'move']
      const filterSet = {}
      Object.keys(this.events).forEach(key => {
        if (filters.indexOf(key) !== -1) filterSet[key] = this.events[key]
      })
      Object.keys(filterSet).forEach(key => {
        eventHelper.addListener(this.$amapComponent.editor, key, filterSet[key])
      })
    }
  }
}