diff --git a/src/components/Main/Share/index.tsx b/src/components/Main/Share/index.tsx
index 4c4b863..767f8cd 100644
--- a/src/components/Main/Share/index.tsx
+++ b/src/components/Main/Share/index.tsx
@@ -2,6 +2,6 @@
import { FunctionComponent } from "react";
const MainShare: FunctionComponent = () => {
- return
分享
;
+ return
分享22222
;
};
export default MainShare;
diff --git a/src/context/file-icon.ts b/src/context/file-icon.ts
new file mode 100644
index 0000000..d888a21
--- /dev/null
+++ b/src/context/file-icon.ts
@@ -0,0 +1,11 @@
+/** @format */
+
+import jpg from "@/assets/icons/files/jpg.svg";
+import png from "@/assets/icons/files/png.svg";
+import pdf from "@/assets/icons/files/pdf.svg";
+const FileIcon: any = {
+ jpg: jpg,
+ png: png,
+ pdf: pdf,
+};
+export default FileIcon;
diff --git a/src/main.tsx b/src/main.tsx
index 0fef842..e37d53c 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -7,7 +7,6 @@ import { Provider as MobxProvider } from "mobx-react";
import { RootStore } from "@/store";
import routeConfig from "@/router/routes.ts";
import { createBrowserRouter, RouterProvider } from "react-router-dom";
-
const router = createBrowserRouter(routeConfig);
ReactDOM.createRoot(document.getElementById("root")!).render(
diff --git a/src/router/routes.ts b/src/router/routes.ts
index f44b5f4..bdbdb50 100644
--- a/src/router/routes.ts
+++ b/src/router/routes.ts
@@ -16,7 +16,6 @@ import MainFile from "@/router/modules/main/file";
import MainUserInfo from "@/router/modules/main/userInfo";
import MainUserSetting from "@/router/modules/main/userSetting";
import MainShare from "@/router/modules/main/share";
-
const routes: RouteObject[] = [
{
path: "/",
diff --git a/src/store/index.ts b/src/store/index.ts
index 66d4340..2bcdaaa 100644
--- a/src/store/index.ts
+++ b/src/store/index.ts
@@ -1,8 +1,10 @@
/** @format */
import { useUserStore } from "./modules/user.ts";
+import { useFileStore } from "@/store/modules/file.ts";
/** 将每个Store实例化 */
export const RootStore = {
user: new useUserStore(),
+ file: new useFileStore(),
};
diff --git a/src/store/modules/file.ts b/src/store/modules/file.ts
new file mode 100644
index 0000000..889cd5b
--- /dev/null
+++ b/src/store/modules/file.ts
@@ -0,0 +1,69 @@
+/** @format */
+
+import { action, makeObservable, observable } from "mobx";
+import { isHydrated, makePersistable } from "mobx-persist-store";
+import { handleLocalforage } from "@/utils/localforage";
+
+export class useFileStore {
+ filePath: [any] = [
+ {
+ title: "/ root",
+ },
+ ];
+
+ constructor() {
+ makeObservable(this, {
+ filePath: observable,
+ setFilePath: action,
+ getFilePath: action,
+ clearFilePath: action,
+ getFilePathSecondLast: action,
+ isHydrated: action,
+ });
+ makePersistable(
+ this,
+ {
+ // 在构造函数内使用 makePersistable
+ name: "file", // 保存的name,用于在storage中的名称标识,只要不和storage中其他名称重复就可以
+ properties: ["filePath"], // 要保存的字段,这些字段会被保存在name对应的storage中,注意:不写在这里面的字段将不会被保存,刷新页面也将丢失:get字段例外。get数据会在数据返回后再自动计算
+ storage: handleLocalforage, // 保存的位置:可以是localStorage,sessionstorage
+ removeOnExpiration: true, //如果 expireIn 具有值且已过期,则在调用 getItem 时将自动删除存储中的数据。默认值为 true。
+ stringify: false, //如果为 true,则数据在传递给 setItem 之前将是 JSON.stringify。默认值为 true。
+ expireIn: 2592000000, // 一个以毫秒为单位的值,用于确定 getItem 何时不应检索存储中的数据。默认情况下永不过期。
+ debugMode: false, // 如果为 true,将为多个 mobx-persist-store 项调用 console.info。默认值为 false。
+ },
+ {
+ delay: 0, // 允许您设置一个 delay 选项来限制 write 函数的调用次数。默认情况下没有延迟。
+ fireImmediately: false, // 确定是应立即保留存储数据,还是等到存储中的属性发生更改。 false 默认情况下。
+ },
+ ).then(
+ action(() => {
+ // persist 完成的回调,在这里可以执行一些拿到数据后需要执行的操作,如果在页面上要判断是否完成persist,使用 isHydrated
+ // console.log(persistStore)
+ }),
+ );
+ }
+ // 获取文件路径
+ getFilePath() {
+ return this.filePath ? this.filePath : [];
+ }
+ // 设置文件路径
+ setFilePath(path: any) {
+ this.filePath.push(path);
+ }
+ // 删除文件路径最后一个
+ clearFilePath() {
+ if (this.filePath.length === 1) {
+ return;
+ }
+ this.filePath.pop();
+ }
+ // 获取文件路径倒数第二个
+ getFilePathSecondLast() {
+ return this.filePath.slice(0, -1).pop();
+ }
+
+ isHydrated() {
+ return isHydrated(this);
+ }
+}
diff --git a/src/views/Main/index.tsx b/src/views/Main/index.tsx
index 2e9c73b..23bfabc 100644
--- a/src/views/Main/index.tsx
+++ b/src/views/Main/index.tsx
@@ -24,7 +24,9 @@ export default function Layout() {
{defaultDom};
}}
{...defaultProps}
+ disableMobile={true}
location={{
pathname: location.pathname,
}}
avatarProps={{
src: "https://gw.alipayobjects.com/zos/antfincdn/efFD%24IOql2/weixintupian_20170331104822.jpg",
title: "七妮妮",
- size: "small",
- // @ts-ignore
+ size: "large",
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-expect-error
render: (props, dom) => {
return (