mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-09-13 01:56:22 +08:00
fix: Fix folder redirection issue
This commit is contained in:
parent
bc8d564ce8
commit
0eff8d604c
1 changed files with 51 additions and 29 deletions
|
@ -1627,40 +1627,64 @@ function hideRightMenu() {
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (localStorage.getItem('show-hidden') === null) {
|
initShowHidden();
|
||||||
localStorage.setItem('show-hidden', 'true');
|
initTabsAndPaths();
|
||||||
}
|
|
||||||
req.showHidden = localStorage.getItem('show-hidden') === 'true';
|
|
||||||
getHostMount();
|
getHostMount();
|
||||||
if (router.currentRoute.value.query.path) {
|
initHistory();
|
||||||
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 = getCurrentPath()?.offsetWidth;
|
|
||||||
paths.value = [];
|
|
||||||
|
|
||||||
const segments = editableTabsValue.value.split('/').filter(Boolean);
|
|
||||||
let url = '';
|
|
||||||
segments.forEach((segment) => {
|
|
||||||
url += '/' + segment;
|
|
||||||
paths.value.push({
|
|
||||||
url,
|
|
||||||
name: segment,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
search();
|
|
||||||
history.push(req.path);
|
|
||||||
pointer = history.length - 1;
|
|
||||||
nextTick(function () {
|
nextTick(function () {
|
||||||
handlePath();
|
handlePath();
|
||||||
observeResize();
|
observeResize();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function initShowHidden() {
|
||||||
|
const showHidden = localStorage.getItem('show-hidden');
|
||||||
|
if (showHidden === null) {
|
||||||
|
localStorage.setItem('show-hidden', 'true');
|
||||||
|
req.showHidden = true;
|
||||||
|
} else {
|
||||||
|
req.showHidden = showHidden === 'true';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function initTabsAndPaths() {
|
||||||
|
initTabs();
|
||||||
|
let path = getInitialPath();
|
||||||
|
req.path = path;
|
||||||
|
getPaths(path);
|
||||||
|
editableTabsValue.value = path;
|
||||||
|
updateTab(path);
|
||||||
|
paths.value = buildPaths(path);
|
||||||
|
pathWidth.value = getCurrentPath()?.offsetWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildPaths(path: string) {
|
||||||
|
const segments = path.split('/').filter(Boolean);
|
||||||
|
let url = '';
|
||||||
|
return segments.map((segment) => {
|
||||||
|
url += '/' + segment;
|
||||||
|
return { url, name: segment };
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function initHistory() {
|
||||||
|
search();
|
||||||
|
history.push(req.path);
|
||||||
|
pointer = history.length - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getInitialPath(): string {
|
||||||
|
const routePath = router.currentRoute.value.query.path;
|
||||||
|
if (routePath) {
|
||||||
|
const p = String(routePath);
|
||||||
|
globalStore.setLastFilePath(p);
|
||||||
|
return p;
|
||||||
|
} else if (globalStore.lastFilePath && globalStore.lastFilePath !== '') {
|
||||||
|
return globalStore.lastFilePath;
|
||||||
|
}
|
||||||
|
return '/';
|
||||||
|
}
|
||||||
|
|
||||||
const editableTabsKey = ref('');
|
const editableTabsKey = ref('');
|
||||||
const editableTabsValue = ref('');
|
const editableTabsValue = ref('');
|
||||||
const editableTabsName = ref('');
|
const editableTabsName = ref('');
|
||||||
|
@ -1699,8 +1723,6 @@ function setFirstTab() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initTabs();
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
[editableTabs, editableTabsKey],
|
[editableTabs, editableTabsKey],
|
||||||
([newTabs, newKey]) => {
|
([newTabs, newKey]) => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue