fix(PdfPreviewPage): 在组件卸载前清除刷新标记
添加onBeforeUnmount钩子清除sessionStorage中的刷新标记,防止状态残留
Showing
1 changed file
with
9 additions
and
1 deletions
| ... | @@ -12,7 +12,7 @@ | ... | @@ -12,7 +12,7 @@ |
| 12 | </template> | 12 | </template> |
| 13 | 13 | ||
| 14 | <script setup> | 14 | <script setup> |
| 15 | -import { computed, onMounted } from 'vue' | 15 | +import { computed, onMounted, onBeforeUnmount } from 'vue' |
| 16 | import { useRoute, useRouter } from 'vue-router' | 16 | import { useRoute, useRouter } from 'vue-router' |
| 17 | import PdfViewer from '@/components/ui/PdfViewer.vue' | 17 | import PdfViewer from '@/components/ui/PdfViewer.vue' |
| 18 | 18 | ||
| ... | @@ -60,6 +60,14 @@ onMounted(() => { | ... | @@ -60,6 +60,14 @@ onMounted(() => { |
| 60 | window.location.reload() | 60 | window.location.reload() |
| 61 | } | 61 | } |
| 62 | }) | 62 | }) |
| 63 | + | ||
| 64 | +/** | ||
| 65 | + * 组件卸载前清除刷新标记 | ||
| 66 | + */ | ||
| 67 | +onBeforeUnmount(() => { | ||
| 68 | + // 清除刷新标记,确保离开页面时清理状态 | ||
| 69 | + sessionStorage.removeItem('pdf-preview-refreshed') | ||
| 70 | +}) | ||
| 63 | </script> | 71 | </script> |
| 64 | 72 | ||
| 65 | <style scoped> | 73 | <style scoped> | ... | ... |
-
Please register or login to post a comment