Skip to content

Commit

Permalink
fix: 修复预览弹窗
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Jan 17, 2024
1 parent bcb48df commit 00cec2f
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sub-store-front-end",
"version": "2.14.67",
"version": "2.14.70",
"private": true,
"scripts": {
"dev": "vite --host",
Expand Down
24 changes: 24 additions & 0 deletions src/components/FileListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
}>();
// console.log('props.disabled')
// console.log(props.disabled)
let scrollTop = 0;
const filePreviewIsVisible = ref(false);
usePopupRoute(filePreviewIsVisible);
const previewData = ref();
Expand Down Expand Up @@ -247,7 +248,20 @@
});
const closePreview = () => {
document.querySelector('html').style['overflow-y'] = '';
document.querySelector('html').style.height = '';
document.body.style.height = '';
document.body.style['overflow-y'] = '';
(document.querySelector('#app') as HTMLElement).style['overflow-y'] = '';
(document.querySelector('#app') as HTMLElement).style.height = '';
filePreviewIsVisible.value = false;
window.scrollTo({
top: scrollTop,
behavior: "instant"

Check failure on line 262 in src/components/FileListItem.vue

View workflow job for this annotation

GitHub Actions / build

Type '"instant"' is not assignable to type 'ScrollBehavior'.

Check failure on line 262 in src/components/FileListItem.vue

View workflow job for this annotation

GitHub Actions / deploy

Type '"instant"' is not assignable to type 'ScrollBehavior'.
});
router.back();
};
Expand All @@ -260,6 +274,16 @@
if (res?.data?.status === 'success') {
previewData.value = res.data.data;
scrollTop = document.documentElement.scrollTop || document.body.scrollTop
document.querySelector('html').style['overflow-y'] = 'hidden';
document.querySelector('html').style.height = '100%';
document.body.style.height = '100%';
document.body.style['overflow-y'] = 'hidden';
(document.querySelector('#app') as HTMLElement).style['overflow-y'] = 'hidden';
(document.querySelector('#app') as HTMLElement).style.height = '100%';
filePreviewIsVisible.value = true;
Toast.hide('compare');
}
Expand Down
25 changes: 25 additions & 0 deletions src/components/SubListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@
}>();
// console.log('props.disabled')
// console.log(props.disabled)
let scrollTop = 0;
const compareTableIsVisible = ref(false);
usePopupRoute(compareTableIsVisible);
Expand Down Expand Up @@ -326,7 +328,20 @@
});
const closeCompare = () => {
document.querySelector('html').style['overflow-y'] = '';
document.querySelector('html').style.height = '';
document.body.style.height = '';
document.body.style['overflow-y'] = '';
(document.querySelector('#app') as HTMLElement).style['overflow-y'] = '';
(document.querySelector('#app') as HTMLElement).style.height = '';
compareTableIsVisible.value = false;
window.scrollTo({
top: scrollTop,
behavior: "instant"

Check failure on line 342 in src/components/SubListItem.vue

View workflow job for this annotation

GitHub Actions / build

Type '"instant"' is not assignable to type 'ScrollBehavior'.

Check failure on line 342 in src/components/SubListItem.vue

View workflow job for this annotation

GitHub Actions / deploy

Type '"instant"' is not assignable to type 'ScrollBehavior'.
});
router.back();
};
Expand All @@ -338,6 +353,16 @@
);
if (res?.data?.status === 'success') {
compareData.value = res.data.data;
scrollTop = document.documentElement.scrollTop || document.body.scrollTop
document.querySelector('html').style['overflow-y'] = 'hidden';
document.querySelector('html').style.height = '100%';
document.body.style.height = '100%';
document.body.style['overflow-y'] = 'hidden';
(document.querySelector('#app') as HTMLElement).style['overflow-y'] = 'hidden';
(document.querySelector('#app') as HTMLElement).style.height = '100%';
compareTableIsVisible.value = true;
Toast.hide('compare');
}
Expand Down
25 changes: 25 additions & 0 deletions src/views/FileEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@
const { bottomSafeArea } = storeToRefs(globalStore);
const padding = bottomSafeArea.value + 'px';
let scrollTop = 0;
const file = computed(() => subsStore.getOneFile(configName));
const filePreviewIsVisible = ref(false);
usePopupRoute(filePreviewIsVisible);
Expand Down Expand Up @@ -307,7 +309,20 @@
deleteItem(form, actionsList, actionsChecked, id);
};
const closePreview = () => {
document.querySelector('html').style['overflow-y'] = '';
document.querySelector('html').style.height = '';
document.body.style.height = '';
document.body.style['overflow-y'] = '';
(document.querySelector('#app') as HTMLElement).style['overflow-y'] = '';
(document.querySelector('#app') as HTMLElement).style.height = '';
filePreviewIsVisible.value = false;
window.scrollTo({
top: scrollTop,
behavior: "instant"

Check failure on line 323 in src/views/FileEditor.vue

View workflow job for this annotation

GitHub Actions / build

Type '"instant"' is not assignable to type 'ScrollBehavior'.

Check failure on line 323 in src/views/FileEditor.vue

View workflow job for this annotation

GitHub Actions / deploy

Type '"instant"' is not assignable to type 'ScrollBehavior'.
});
router.back();
};
const compare = () => {
Expand Down Expand Up @@ -343,6 +358,16 @@
const res = await subsApi.compareSub('file', data);
if (res?.data?.status === 'success') {
previewData.value = res.data.data;
scrollTop = document.documentElement.scrollTop || document.body.scrollTop
document.querySelector('html').style['overflow-y'] = 'hidden';
document.querySelector('html').style.height = '100%';
document.body.style.height = '100%';
document.body.style['overflow-y'] = 'hidden';
(document.querySelector('#app') as HTMLElement).style['overflow-y'] = 'hidden';
(document.querySelector('#app') as HTMLElement).style.height = '100%';
filePreviewIsVisible.value = true;
Toast.hide('compare');
}
Expand Down
3 changes: 3 additions & 0 deletions src/views/FilePreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@
}
.compare-page-wrapper {
top: 0;
left: 0;
position: absolute;
width: 100vw;
height: 100vh;
z-index: 1000;
Expand Down
24 changes: 24 additions & 0 deletions src/views/SubEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@
usePopupRoute(compareTableIsVisible);
const compareData = ref();
let scrollTop = 0
const isInit = ref(false);
const ruleForm = ref<any>(null);
const actionsChecked = reactive([]);
Expand Down Expand Up @@ -415,7 +416,20 @@
};
const closeCompare = () => {
document.querySelector('html').style['overflow-y'] = '';
document.querySelector('html').style.height = '';
document.body.style.height = '';
document.body.style['overflow-y'] = '';
(document.querySelector('#app') as HTMLElement).style['overflow-y'] = '';
(document.querySelector('#app') as HTMLElement).style.height = '';
compareTableIsVisible.value = false;
window.scrollTo({
top: scrollTop,
behavior: "instant"

Check failure on line 430 in src/views/SubEditor.vue

View workflow job for this annotation

GitHub Actions / build

Type '"instant"' is not assignable to type 'ScrollBehavior'.

Check failure on line 430 in src/views/SubEditor.vue

View workflow job for this annotation

GitHub Actions / deploy

Type '"instant"' is not assignable to type 'ScrollBehavior'.
});
router.back();
};
Expand Down Expand Up @@ -453,6 +467,16 @@
const res = await subsApi.compareSub(type, data);
if (res?.data?.status === 'success') {
compareData.value = res.data.data;
scrollTop = document.documentElement.scrollTop || document.body.scrollTop
document.querySelector('html').style['overflow-y'] = 'hidden';
document.querySelector('html').style.height = '100%';
document.body.style.height = '100%';
document.body.style['overflow-y'] = 'hidden';
(document.querySelector('#app') as HTMLElement).style['overflow-y'] = 'hidden';
(document.querySelector('#app') as HTMLElement).style.height = '100%';
compareTableIsVisible.value = true;
Toast.hide('compare');
}
Expand Down

0 comments on commit 00cec2f

Please sign in to comment.