Skip to content

Commit 0e97692

Browse files
committed
fixed bug
1 parent 441eaa4 commit 0e97692

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454
"less-loader": "^5.0.0",
5555
"lint-staged": "^12.1.3",
5656
"prettier": "^2.2.1",
57-
"typescript": "~4.1.5"
57+
"typescript": "~4.1.5",
58+
"vue-eslint-parser": "^8.0.1"
5859
},
5960
"repository": {
6061
"type": "git",

src/widgets/basic/manage-layers/index.vue

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import MarsDialog from "@mars/components/mars-work/mars-dialog.vue"
2626
import { onUnmounted, nextTick, reactive, ref } from "vue"
2727
import useLifecycle from "@mars/common/uses/use-lifecycle"
28+
import useClock from "@mars/common/uses/use-clock"
2829
import * as mapWork from "./map"
2930
import { useWidget } from "@mars/common/store/widget"
3031
@@ -35,6 +36,7 @@ onUnmounted(() => {
3536
})
3637
3738
useLifecycle(mapWork)
39+
const clock = useClock()
3840
3941
const treeData = ref<any[]>([])
4042
@@ -54,7 +56,6 @@ let lastWidget: any
5456
const checkedChange = (keys: string[], e: any) => {
5557
const layer = layersObj[e.node.id]
5658
// console.log("点击的矢量图层", layer)
57-
5859
if (layer) {
5960
if (!layer.isAdded) {
6061
mapWork.addLayer(layer)
@@ -94,22 +95,31 @@ const checkedChange = (keys: string[], e: any) => {
9495
initLayerTree(layer)
9596
}
9697
97-
// 处理图层的关联事件
98+
// 处理图层的关联事件 TODO: show-clock 封装为widget
9899
if (layer.options.onWidget) {
99100
if (e.checked) {
100-
if (lastWidget) {
101+
if (lastWidget === "show-clock") {
102+
clock.closeClock()
103+
} else if (lastWidget) {
101104
disable(lastWidget)
102105
}
103-
activate({
104-
name: layer.options.onWidget
105-
})
106+
if (layer.options.onWidget === "show-clock") {
107+
clock.showClock()
108+
} else {
109+
activate({
110+
name: layer.options.onWidget
111+
})
112+
}
106113
lastWidget = layer.options.onWidget
107114
} else {
108-
disable(layer.options.onWidget)
115+
if (layer.options.onWidget === "show-clock") {
116+
// clock.closeClock()
117+
} else {
118+
disable(layer.options.onWidget)
119+
}
109120
}
110121
}
111122
}
112-
}
113123
114124
// let show = true
115125
// keys.forEach((id: string) => {

0 commit comments

Comments
 (0)