提交 038b772c 作者: test

fix: 修复 Map.on 事件通信异常写法问题

上级 d11dbf58
...@@ -58,27 +58,27 @@ ...@@ -58,27 +58,27 @@
onMapLoad(data) { onMapLoad(data) {
this.loaded = true this.loaded = true
Message.hideLoading() Message.hideLoading()
console.log('✨ Map Loaded', data) console.debug('✨ Map Loaded', data)
// 触发 onLoaded 事件 // 触发 onLoaded 事件
this.onLoadedEvent?.(data) this.onLoadedEvent?.(data)
}, },
onSourceRequestHandle(data) { onSourceRequestHandle(data) {
console.log('✨ Request Handle', data) console.debug('✨ Request Handle', data)
// 触发 onSourceRequestHandle 事件 // 触发 onSourceRequestHandle 事件
this.onSourceRequestHandleEvent?.(data) this.onSourceRequestHandleEvent?.(data)
}, },
// 尝试触发事件, 通过 changeLock 控制 // 尝试触发事件, 通过 changeLock 控制
tryTriggerChange() { tryTriggerChange() {
if (!this.changeLock && this.changeOptionsQueue.length) { if (!this.changeLock && this.changeOptionsQueue.length) {
this.changeLock = true
const item = this.changeOptionsQueue.shift() const item = this.changeOptionsQueue.shift()
this[`${item.fn}Options`] = item this[`${item.fn}Options`] = item
this.changeLock = true
} }
}, },
// 监听地图配置从逻辑层到视图层的响应式变化事件 // 监听地图配置从逻辑层到视图层的响应式变化事件
onMapOptionsChangeEvent(event) { onMapOptionsChangeEvent(event) {
console.log('✨ Map Event', event) console.debug('✨ Map Event', event)
this.changeLock = false this.changeLock = false
this.tryTriggerChange() this.tryTriggerChange()
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
customEvent(event, type, layer, ...args) { customEvent(event, type, layer, ...args) {
// 加入到 change 事件队列中 // 加入到 change 事件队列中
this.changeOptionsQueue.push({ this.changeOptionsQueue.push({
fn: event, fn: 'event',
event, event,
type, type,
layer, layer,
......
...@@ -204,7 +204,6 @@ export default { ...@@ -204,7 +204,6 @@ export default {
this.emitChangeEvent(options.fn) this.emitChangeEvent(options.fn)
if (this.checkOnChangeValidity(options)) { if (this.checkOnChangeValidity(options)) {
this.map.addLayer(options.layer, options.beforeId) this.map.addLayer(options.layer, options.beforeId)
console.log('options', options)
} }
}, },
changeRemoveOptions(options) { changeRemoveOptions(options) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论