fix: remain in the same position of list when back

This commit is contained in:
niubility000 2024-03-16 02:55:06 +08:00 committed by GitHub
parent 1c079a2719
commit b27d5b2dcc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,6 +4,7 @@
<breadcrumbs base="/files" /> <breadcrumbs base="/files" />
<listing /> <listing />
<transition name="closing">
<errors v-if="error" :errorCode="error.status" /> <errors v-if="error" :errorCode="error.status" />
<component v-else-if="currentView" :is="currentView"></component> <component v-else-if="currentView" :is="currentView"></component>
<div v-else-if="currentView !== null"> <div v-else-if="currentView !== null">
@ -16,6 +17,7 @@
<span>{{ $t("files.loading") }}</span> <span>{{ $t("files.loading") }}</span>
</h2> </h2>
</div> </div>
</transition>
</div> </div>
</template> </template>
@ -79,21 +81,13 @@ export default {
if (from.path.endsWith("/")) { if (from.path.endsWith("/")) {
if (to.path.endsWith("/")) { if (to.path.endsWith("/")) {
window.sessionStorage.setItem("listFrozen", "false"); window.sessionStorage.setItem("listFrozen", "false");
this.fetchData();
return;
} else { } else {
window.sessionStorage.setItem("listFrozen", "true"); window.sessionStorage.setItem("listFrozen", "true");
this.fetchData();
return;
} }
} else if (to.path.endsWith("/")) { } else if (to.path.endsWith("/")) {
this.$store.commit("updateRequest", {}); this.$store.commit("updateRequest", {});
this.fetchData();
return;
} else {
this.fetchData();
return;
} }
this.fetchData();
}, },
reload: function (value) { reload: function (value) {
if (value === true) { if (value === true) {
@ -159,3 +153,13 @@ export default {
}, },
}; };
</script> </script>
<style>
.closing-leave-active {
animation: closing 0.5s
}
@keyframes closing {
to {
transform: scale(0);
}
}
</style>