File tree Expand file tree Collapse file tree 2 files changed +4
-13
lines changed Expand file tree Collapse file tree 2 files changed +4
-13
lines changed Original file line number Diff line number Diff line change 3
3
* @copyright 火星科技 mars3d.cn
4
4
* @author 火星吴彦祖 2022-02-19
5
5
*/
6
- import { inject , onMounted , onUnmounted } from "vue"
6
+ import { inject , onBeforeMount , onBeforeUnmount } from "vue"
7
7
8
8
export default function useLifecycle ( mapWork : any ) : void {
9
9
const getMapInstance = inject < any > ( "getMapInstance" )
10
- onMounted ( ( ) => {
10
+ onBeforeMount ( ( ) => {
11
11
if ( mapWork . onMounted ) {
12
12
const map = getMapInstance ( )
13
13
mapWork . onMounted ( map )
14
14
}
15
15
} )
16
- onUnmounted ( ( ) => {
16
+ onBeforeUnmount ( ( ) => {
17
17
if ( mapWork . onUnmounted ) {
18
18
mapWork . onUnmounted ( )
19
19
}
Original file line number Diff line number Diff line change 7
7
* @copyright 火星科技 mars3d.cn
8
8
* @author 火星吴彦祖 2022-02-19
9
9
*/
10
- import { computed , onBeforeUnmount , onMounted } from " vue"
10
+ import { computed , onMounted } from " vue"
11
11
import * as mars3d from " mars3d"
12
12
import { getQueryString , isPc } from " @mars/utils/mars-util"
13
13
import { $alert , $message } from " @mars/components/mars-ui/index"
@@ -131,18 +131,9 @@ function onMapLoad() {
131
131
}
132
132
}
133
133
}
134
-
135
- // 组件卸载之前销毁mars3d实例
136
- onBeforeUnmount (() => {
137
- if (map ) {
138
- map .destroy ()
139
- map = null
140
- }
141
- })
142
134
</script >
143
135
144
136
<style lang="less">
145
-
146
137
/* *cesium 工具按钮栏*/
147
138
.cesium-viewer-toolbar {
148
139
top : auto ;
You can’t perform that action at this time.
0 commit comments