diff --git a/src/layout/components/notice/index.vue b/src/layout/components/notice/index.vue index c4767b9..bab0cf7 100644 --- a/src/layout/components/notice/index.vue +++ b/src/layout/components/notice/index.vue @@ -27,7 +27,6 @@ :title="dialog.title" width="500px" class="monitor-dialog" - append-to-body :before-close="handleMonitorDialogClose" fullscreen destroy-on-close @@ -50,6 +49,7 @@ import { useNoticeStore } from '@/store/modules/notice'; import { listNotice } from '@/api/system/notice'; import { initHls, destroyHls } from '@/utils/video'; +import { onBeforeRouteLeave } from 'vue-router'; const { proxy } = getCurrentInstance() as ComponentInternalInstance; @@ -179,17 +179,72 @@ onMounted(() => { console.log('消息列表:', newsList.value); }); }); + +onBeforeRouteLeave(() => { + dialog.visible = false; + monitorVideoUrl.value = ''; +});