|
@@ -406,17 +406,36 @@ onMounted(() => {
|
|
|
fetchPolicyFiles();
|
|
fetchPolicyFiles();
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+// 滚动位置存储
|
|
|
|
|
+let savedScrollPosition = 0;
|
|
|
|
|
+
|
|
|
|
|
+const lockBodyScroll = () => {
|
|
|
|
|
+ savedScrollPosition = window.scrollY;
|
|
|
|
|
+ document.body.style.position = 'fixed';
|
|
|
|
|
+ document.body.style.top = `-${savedScrollPosition}px`;
|
|
|
|
|
+ document.body.style.width = '100%';
|
|
|
|
|
+ document.body.style.overflow = 'hidden';
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const unlockBodyScroll = () => {
|
|
|
|
|
+ document.body.style.position = '';
|
|
|
|
|
+ document.body.style.top = '';
|
|
|
|
|
+ document.body.style.width = '';
|
|
|
|
|
+ document.body.style.overflow = '';
|
|
|
|
|
+ window.scrollTo(0, savedScrollPosition);
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
onUnmounted(() => {
|
|
onUnmounted(() => {
|
|
|
- document.body.style.overflow = "";
|
|
|
|
|
|
|
+ unlockBodyScroll();
|
|
|
if (scrollTimer) clearTimeout(scrollTimer);
|
|
if (scrollTimer) clearTimeout(scrollTimer);
|
|
|
if (searchTimer) clearTimeout(searchTimer);
|
|
if (searchTimer) clearTimeout(searchTimer);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
watch(previewVisible, (val) => {
|
|
watch(previewVisible, (val) => {
|
|
|
if (val) {
|
|
if (val) {
|
|
|
- document.body.style.overflow = "hidden";
|
|
|
|
|
|
|
+ lockBodyScroll();
|
|
|
} else {
|
|
} else {
|
|
|
- document.body.style.overflow = "";
|
|
|
|
|
|
|
+ unlockBodyScroll();
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
@@ -809,15 +828,15 @@ watch(previewVisible, (val) => {
|
|
|
.preview-body {
|
|
.preview-body {
|
|
|
flex: 1;
|
|
flex: 1;
|
|
|
background: #111827;
|
|
background: #111827;
|
|
|
- display: flex;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
- justify-content: center;
|
|
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+ overflow: hidden;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.preview-frame {
|
|
.preview-frame {
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
height: 100%;
|
|
height: 100%;
|
|
|
border: none;
|
|
border: none;
|
|
|
|
|
+ display: block;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.preview-placeholder {
|
|
.preview-placeholder {
|