docs: 没有更改

This commit is contained in:
wf 2024-04-12 12:29:16 +08:00
parent 80af0bd77b
commit 12a2323c18
2 changed files with 41 additions and 41 deletions

View File

@ -1,9 +1,9 @@
// https://pinia.vuejs.org/zh/ // https://pinia.vuejs.org/zh/
// store/index.js // store/index.js
import { createPinia } from "pinia"; import { createPinia } from "pinia";
// 创建 // 创建
const pinia = createPinia(); const pinia = createPinia();
// 导出 // 导出
export default pinia; export default pinia;

View File

@ -1,32 +1,32 @@
import { defineStore } from "pinia"; import { defineStore } from "pinia";
/** /**
* *
* @methods setAccount * @methods setAccount
* @methods setToken token * @methods setToken token
* @methods logOut 退 * @methods logOut 退
*/ */
export const useUserInfoStore = defineStore("routeList", { export const useUserInfoStore = defineStore("routeList", {
state: (): any => ({ state: (): any => ({
account: { account: {
username: "", username: "",
roles: [] roles: []
}, // 账号信息 }, // 账号信息
token: "" // token token: "" // token
}), }),
actions: { actions: {
async setAccount(data: Array<string>) { async setAccount(data: Array<string>) {
this.account = data; this.account = data;
}, },
async setToken(data: string) { async setToken(data: string) {
this.token = data; this.token = data;
}, },
async logOut() { async logOut() {
this.account = {}; this.account = {};
this.token = ""; this.token = "";
} }
}, },
persist: { persist: {
enabled: true // 开启数据缓存-默认缓存全部数据 enabled: true // 开启数据缓存-默认缓存全部数据
} }
}); });