This commit is contained in:
539943419 committed 2024-08-11 01:00:49 +08:00
1 parent a668b3b840
commit 1d4feb471c
9 files changed
+342 -103

No files matched your search

+23 -11
View File
@@ -1,36 +1,48 @@
import VirtualDirectory from "./virtualDirectory";
import generateId from "@/hooks/generateId";
const getRandomWebSafeColor = (() => {
const webSafeColors = ["#009900", "#999900", "#009999", "#990099", "#0000ee"];
let counter = 0
return () => {
const color = webSafeColors[counter % webSafeColors.length]
counter += 1
return color;
};
})();
export default class VirtualPage {
constructor(initDirectory: VirtualDirectory) {
this.visible = true;
this.uid = generateId()
this.currentDirectory = initDirectory
this.refreshKey = Math.random()
this.uid = generateId();
this.currentDirectory = initDirectory;
this.refreshKey = Math.random();
this.color = getRandomWebSafeColor();
}
visible: boolean;
currentDirectory: VirtualDirectory;
// 区分每一个页面的唯一id
uid: number;
// 当refreshKey改变时需要刷新页面,目前还没接入刷新
refreshKey:number;
refreshKey: number;
get title(){
return this.currentDirectory.name
color: string;
get title() {
return this.currentDirectory.name;
}
// 切换显示状态
switchShow() {
this.visible = !this.visible;
}
// 设置(同步)正在展示的文件夹
setCurrrentDirectory(currDir: VirtualDirectory) {
this.currentDirectory = currDir
this.currentDirectory = currDir;
}
refresh(){
this.refreshKey = Math.random()
refresh() {
this.refreshKey = Math.random();
}
}