Showing
1 changed file
with
9 additions
and
10 deletions
... | ... | @@ -14,7 +14,7 @@ |
14 | 14 | import { useBaiduMapSDK } from '../../../hook/useBaiduMapSDK'; |
15 | 15 | import { HistoryModalOkEmitParams, TrackAnimationStatus } from './type'; |
16 | 16 | import { useMapTrackPlayback } from './useMapTrackPlayback'; |
17 | - import { shallowRef } from 'vue'; | |
17 | + // import { shallowRef } from 'vue'; | |
18 | 18 | import { formatToDateTime } from '/@/utils/dateUtil'; |
19 | 19 | |
20 | 20 | const props = defineProps<{ |
... | ... | @@ -25,7 +25,7 @@ |
25 | 25 | |
26 | 26 | const wrapId = `bai-map-${buildUUID()}`; |
27 | 27 | |
28 | - const mapInstance = shallowRef<Nullable<Recordable>>(null); | |
28 | + const mapInstance = ref<Nullable<Recordable>>(null); | |
29 | 29 | |
30 | 30 | const rangString = ref<Nullable<string>>(null); |
31 | 31 | |
... | ... | @@ -35,6 +35,9 @@ |
35 | 35 | openModal(true, toRaw(props.config.option.dataSource)); |
36 | 36 | }; |
37 | 37 | |
38 | + const { genTrackPlaybackAnimation, playStatus, playFn, continueFn, pauseFn } = | |
39 | + useMapTrackPlayback(mapInstance); | |
40 | + | |
38 | 41 | const getIsWidgetLibSelectMode = computed(() => { |
39 | 42 | return !props.config.option.dataSource; |
40 | 43 | }); |
... | ... | @@ -68,8 +71,8 @@ |
68 | 71 | async function initMap() { |
69 | 72 | const wrapEl = unref(wrapRef); |
70 | 73 | if (!wrapEl) return; |
71 | - const BMapGL = (window as any).BMapGL; | |
72 | 74 | if (!Reflect.has(window, 'BMapGL')) return; |
75 | + const BMapGL = (window as any).BMapGL; | |
73 | 76 | mapInstance.value = new BMapGL.Map(wrapId); |
74 | 77 | |
75 | 78 | // 定位当前城市 |
... | ... | @@ -89,13 +92,10 @@ |
89 | 92 | } |
90 | 93 | |
91 | 94 | const { loading } = useBaiduMapSDK(initMap); |
92 | - | |
93 | - const { genTrackPlaybackAnimation, playStatus, playFn, continueFn, pauseFn } = | |
94 | - useMapTrackPlayback(mapInstance); | |
95 | 95 | </script> |
96 | 96 | |
97 | 97 | <template> |
98 | - <main class="w-full h-full flex flex-col justify-center items-center"> | |
98 | + <main class="w-full h-full flex flex-col p-2 justify-center items-center"> | |
99 | 99 | <div class="w-full flex justify-end"> |
100 | 100 | <Button |
101 | 101 | type="text" |
... | ... | @@ -126,9 +126,8 @@ |
126 | 126 | :spinning="loading" |
127 | 127 | wrapper-class-name="map-spin-wrapper !w-full !h-full !flex justify-center items-center pointer-events-none" |
128 | 128 | tip="地图加载中..." |
129 | - > | |
130 | - <div ref="wrapRef" :id="wrapId" class="w-full h-full no-drag"> </div> | |
131 | - </Spin> | |
129 | + /> | |
130 | + <div ref="wrapRef" :id="wrapId" class="w-full h-full no-drag"> </div> | |
132 | 131 | |
133 | 132 | <HistoryDataModel @register="register" @ok="handleRenderHistroyData" /> |
134 | 133 | </main> | ... | ... |