mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-11-08 02:36:01 +08:00
feat: 文件列表记录最后一次位置 (#1753)
Refs https://github.com/1Panel-dev/1Panel/issues/1254
This commit is contained in:
parent
4d368a4de8
commit
1a6c45c526
3 changed files with 13 additions and 0 deletions
|
|
@ -26,6 +26,7 @@ export const GlobalStore = defineStore({
|
|||
hasNewVersion: false,
|
||||
ignoreCaptcha: true,
|
||||
device: DeviceType.Desktop,
|
||||
lastFilePath: '',
|
||||
}),
|
||||
getters: {},
|
||||
actions: {
|
||||
|
|
@ -60,6 +61,9 @@ export const GlobalStore = defineStore({
|
|||
isMobile() {
|
||||
return this.device === DeviceType.Mobile;
|
||||
},
|
||||
setLastFilePath(path: string) {
|
||||
this.lastFilePath = path;
|
||||
},
|
||||
},
|
||||
persist: piniaPersistConfig('GlobalState'),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ export interface GlobalState {
|
|||
hasNewVersion: boolean;
|
||||
ignoreCaptcha: boolean;
|
||||
device: DeviceType;
|
||||
lastFilePath: string;
|
||||
}
|
||||
|
||||
export interface MenuState {
|
||||
|
|
|
|||
|
|
@ -363,6 +363,8 @@ const jump = async (url: string) => {
|
|||
req.containSub = false;
|
||||
req.search = '';
|
||||
let searchResult = await searchFile();
|
||||
|
||||
globalStore.setLastFilePath(req.path);
|
||||
// check search result,the file is exists?
|
||||
if (!searchResult.data.path) {
|
||||
req.path = oldUrl;
|
||||
|
|
@ -636,6 +638,12 @@ onMounted(() => {
|
|||
if (router.currentRoute.value.query.path) {
|
||||
req.path = String(router.currentRoute.value.query.path);
|
||||
getPaths(req.path);
|
||||
globalStore.setLastFilePath(req.path);
|
||||
} else {
|
||||
if (globalStore.lastFilePath && globalStore.lastFilePath != '') {
|
||||
req.path = globalStore.lastFilePath;
|
||||
getPaths(req.path);
|
||||
}
|
||||
}
|
||||
pathWidth.value = pathRef.value.offsetWidth * 0.7;
|
||||
search();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue