verce-vue-test 0.0.72 → 0.0.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -10,8 +10,8 @@ export default {
|
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<script setup lang="ts">
|
|
13
|
-
import { onActivated, onBeforeUnmount, onDeactivated, onMounted, ref, type Component } from 'vue'
|
|
14
|
-
import { onBeforeRouteLeave } from 'vue-router'
|
|
13
|
+
import { computed, onActivated, onBeforeUnmount, onDeactivated, onMounted, ref, watch, type Component } from 'vue'
|
|
14
|
+
import { onBeforeRouteLeave, useRoute } from 'vue-router'
|
|
15
15
|
import { storeToRefs } from 'pinia'
|
|
16
16
|
import { Grid, Menu } from '@element-plus/icons-vue'
|
|
17
17
|
import ForecastInfoPanel from './components/ForecastInfoPanel.vue'
|
|
@@ -33,6 +33,15 @@ const layoutOptions: Array<{ label: string; value: ForecastInfoCardLayout; icon:
|
|
|
33
33
|
const forecastInfoStore = useForecastInfoStore()
|
|
34
34
|
const { cardLayout } = storeToRefs(forecastInfoStore)
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* 记录创建当前页面实例的路由记录。
|
|
38
|
+
* 部分多页签 Layout 不会真正卸载旧 RouterView,而是自行缓存后继续保留其 DOM;
|
|
39
|
+
* 此时 Vue 的 deactivated 生命周期不一定会执行,需要根据当前 matched 链主动隐藏旧页面。
|
|
40
|
+
*/
|
|
41
|
+
const route = useRoute()
|
|
42
|
+
const ownerRouteRecord = route.matched[route.matched.length - 1]
|
|
43
|
+
const isCurrentRoute = computed(() => !ownerRouteRecord || route.matched.includes(ownerRouteRecord))
|
|
44
|
+
|
|
36
45
|
/**
|
|
37
46
|
* 页面专属的浮层挂载点。
|
|
38
47
|
* 抽屉和弹窗不再直接挂到 body,避免 Layout 路由切换或 KeepAlive 缓存时遮罩残留在其他页面上。
|
|
@@ -143,9 +152,27 @@ function cleanupBeforeRouteLeave() {
|
|
|
143
152
|
void exitPageFullscreen().catch(() => undefined)
|
|
144
153
|
}
|
|
145
154
|
|
|
146
|
-
return true
|
|
147
155
|
}
|
|
148
156
|
|
|
157
|
+
/**
|
|
158
|
+
* 作为 Layout 缓存实现异常时的最后一道隔离:
|
|
159
|
+
* 路由已切走但旧页面仍留在 DOM 中时,v-show 会同步移除其可视区域和固定定位浮层。
|
|
160
|
+
*/
|
|
161
|
+
watch(
|
|
162
|
+
isCurrentRoute,
|
|
163
|
+
(active) => {
|
|
164
|
+
if (active) {
|
|
165
|
+
startFullscreenListener()
|
|
166
|
+
return
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
stopFullscreenListener()
|
|
170
|
+
closePageTransientOverlays()
|
|
171
|
+
void exitPageFullscreen().catch(() => undefined)
|
|
172
|
+
},
|
|
173
|
+
{ flush: 'sync' },
|
|
174
|
+
)
|
|
175
|
+
|
|
149
176
|
onMounted(startFullscreenListener)
|
|
150
177
|
onActivated(startFullscreenListener)
|
|
151
178
|
onBeforeRouteLeave(cleanupBeforeRouteLeave)
|
|
@@ -164,6 +191,7 @@ onBeforeUnmount(() => {
|
|
|
164
191
|
<template>
|
|
165
192
|
<!-- 水平布局使用两列;垂直布局由公共样式切换为两行等高卡片。 -->
|
|
166
193
|
<div
|
|
194
|
+
v-show="isCurrentRoute"
|
|
167
195
|
ref="pageContainer"
|
|
168
196
|
class="forecast-info-page"
|
|
169
197
|
data-page-scope="rmb-position-settlement-forecast-info"
|