huweili-cesium 1.3.4 → 1.3.5
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.
|
@@ -46,8 +46,22 @@ const wsIndicatorClass = computed(() => {
|
|
|
46
46
|
return 'connected'
|
|
47
47
|
})
|
|
48
48
|
|
|
49
|
+
/** 兼容 template 传入的 HTMLElement 与 ref 对象两种形态 */
|
|
50
|
+
const getContainerRoot = () => {
|
|
51
|
+
const container = props.container
|
|
52
|
+
if (!container) return null
|
|
53
|
+
if (typeof HTMLElement !== 'undefined' && container instanceof HTMLElement) {
|
|
54
|
+
return container
|
|
55
|
+
}
|
|
56
|
+
const refValue = container.value
|
|
57
|
+
if (typeof HTMLElement !== 'undefined' && refValue instanceof HTMLElement) {
|
|
58
|
+
return refValue
|
|
59
|
+
}
|
|
60
|
+
return null
|
|
61
|
+
}
|
|
62
|
+
|
|
49
63
|
const resolveViewerElement = () => {
|
|
50
|
-
const root =
|
|
64
|
+
const root = getContainerRoot()
|
|
51
65
|
if (!root) return null
|
|
52
66
|
return root.querySelector('.cesium-viewer')
|
|
53
67
|
}
|
|
@@ -72,7 +86,7 @@ const startResolveViewerElement = () => {
|
|
|
72
86
|
stopResolveViewerElement()
|
|
73
87
|
if (bindViewerElement()) return
|
|
74
88
|
|
|
75
|
-
const root =
|
|
89
|
+
const root = getContainerRoot()
|
|
76
90
|
if (!root) return
|
|
77
91
|
|
|
78
92
|
viewerObserver = new MutationObserver(() => {
|
|
@@ -106,7 +120,7 @@ const handleWsDisconnected = () => {
|
|
|
106
120
|
}
|
|
107
121
|
|
|
108
122
|
watch(
|
|
109
|
-
() =>
|
|
123
|
+
() => getContainerRoot(),
|
|
110
124
|
() => {
|
|
111
125
|
cesiumViewerEl.value = null
|
|
112
126
|
startResolveViewerElement()
|