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 33 * @copyright 火星科技 mars3d.cn
44 * @author 火星吴彦祖 2022-02-19
55 */
6- import { inject , onMounted , onUnmounted } from "vue"
6+ import { inject , onBeforeMount , onBeforeUnmount } from "vue"
77
88export default function useLifecycle ( mapWork : any ) : void {
99 const getMapInstance = inject < any > ( "getMapInstance" )
10- onMounted ( ( ) => {
10+ onBeforeMount ( ( ) => {
1111 if ( mapWork . onMounted ) {
1212 const map = getMapInstance ( )
1313 mapWork . onMounted ( map )
1414 }
1515 } )
16- onUnmounted ( ( ) => {
16+ onBeforeUnmount ( ( ) => {
1717 if ( mapWork . onUnmounted ) {
1818 mapWork . onUnmounted ( )
1919 }
Original file line number Diff line number Diff line change 77 * @copyright 火星科技 mars3d.cn
88 * @author 火星吴彦祖 2022-02-19
99 */
10- import { computed , onBeforeUnmount , onMounted } from " vue"
10+ import { computed , onMounted } from " vue"
1111import * as mars3d from " mars3d"
1212import { getQueryString , isPc } from " @mars/utils/mars-util"
1313import { $alert , $message } from " @mars/components/mars-ui/index"
@@ -131,18 +131,9 @@ function onMapLoad() {
131131 }
132132 }
133133}
134-
135- // 组件卸载之前销毁mars3d实例
136- onBeforeUnmount (() => {
137- if (map ) {
138- map .destroy ()
139- map = null
140- }
141- })
142134 </script >
143135
144136<style lang="less">
145-
146137/* *cesium 工具按钮栏*/
147138.cesium-viewer-toolbar {
148139 top : auto ;
You can’t perform that action at this time.
0 commit comments