增加app销毁

This commit is contained in:
fan 2023-07-21 15:52:53 +08:00
parent 3e489a9a20
commit 6db77f7668

View File

@ -28,7 +28,7 @@
import { onMounted, ref, computed, onUnmounted, watch } from 'vue'; import { onMounted, ref, computed, onUnmounted, watch } from 'vue';
import { useLineStore } from 'src/stores/line-store'; import { useLineStore } from 'src/stores/line-store';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { loadLineDatas, getLineApp } from 'src/drawApp/lineApp'; import { loadLineDatas, getLineApp, destroyLineApp } from 'src/drawApp/lineApp';
import { destroySimulation } from 'src/api/Simulation'; import { destroySimulation } from 'src/api/Simulation';
import TrainPage from 'src/pages/TrainPage.vue'; import TrainPage from 'src/pages/TrainPage.vue';
import { Train } from 'src/graphics/train/Train'; import { Train } from 'src/graphics/train/Train';
@ -86,6 +86,7 @@ onMounted(() => {
onUnmounted(() => { onUnmounted(() => {
if (simulationId) { if (simulationId) {
lineStore.setSimulationId(null); lineStore.setSimulationId(null);
destroyLineApp();
destroySimulation({ simulationId }); destroySimulation({ simulationId });
} }
}); });