feat: 更新依赖包版本

This commit is contained in:
landaiqing
2024-07-11 17:34:27 +08:00
parent 36625c10c6
commit e79b193b27
5 changed files with 1507 additions and 1187 deletions

View File

@@ -120,7 +120,7 @@ const File: FunctionComponent = () => {
flexDirection: "row",
}}
size={"small"}>
<Avatar src={ali} size={"small"} />{" "}
<Avatar src={ali} size={"small"} />
<span style={{ marginLeft: "10px", fontWeight: "bolder" }}>
OSS
</span>

View File

@@ -1,12 +1,10 @@
/** @format */
import { useUserStore } from "./modules/user.ts";
import { useFileStore } from "@/store/modules/file.ts";
import { UseStorageSettingStore } from "@/store/modules/storage_setting.ts";
/** 将每个Store实例化 */
export const RootStore = {
user: new useUserStore(),
file: new useFileStore(),
storage: new UseStorageSettingStore(),
};
/** @format */
import { useUserStore } from "./modules/user.ts";
import { useFileStore } from "@/store/modules/file.ts";
/** 将每个Store实例化 */
export const RootStore = {
user: new useUserStore(),
file: new useFileStore(),
};

View File

@@ -1,50 +0,0 @@
/** @format */
import { action, makeObservable, observable } from "mobx";
import { isHydrated, makePersistable } from "mobx-persist-store";
import { handleLocalforage } from "@/utils/localforage";
export class UseStorageSettingStore {
selectValue: string = "";
constructor() {
makeObservable(this, {
selectValue: observable,
setSelectValue: action,
getSelectValue: action,
isHydrated: action,
});
makePersistable(
this,
{
// 在构造函数内使用 makePersistable
name: "storage_setting", // 保存的name用于在storage中的名称标识只要不和storage中其他名称重复就可以
properties: ["selectValue"], // 要保存的字段这些字段会被保存在name对应的storage中注意不写在这里面的字段将不会被保存刷新页面也将丢失get字段例外。get数据会在数据返回后再自动计算
storage: handleLocalforage, // 保存的位置可以是localStoragesessionstorage
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)
}),
);
}
getSelectValue() {
return this.selectValue ? this.selectValue : null;
}
setSelectValue(value: any) {
this.selectValue = value;
}
isHydrated() {
return isHydrated(this);
}
}