From 12a2323c18345aaa4049479b92825d0c1fc031ff Mon Sep 17 00:00:00 2001 From: wf <2547096351@qq.com> Date: Fri, 12 Apr 2024 12:29:16 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=B2=A1=E6=9C=89=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/index.ts | 18 ++++++------ src/store/user-info.ts | 64 +++++++++++++++++++++--------------------- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/store/index.ts b/src/store/index.ts index f1382b9..860adb0 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1,9 +1,9 @@ -// https://pinia.vuejs.org/zh/ -// store/index.js -import { createPinia } from "pinia"; - -// 创建 -const pinia = createPinia(); - -// 导出 -export default pinia; +// https://pinia.vuejs.org/zh/ +// store/index.js +import { createPinia } from "pinia"; + +// 创建 +const pinia = createPinia(); + +// 导出 +export default pinia; diff --git a/src/store/user-info.ts b/src/store/user-info.ts index 29ac39e..3313a10 100644 --- a/src/store/user-info.ts +++ b/src/store/user-info.ts @@ -1,32 +1,32 @@ -import { defineStore } from "pinia"; - -/** - * 用户信息 - * @methods setAccount 设置账号信息 - * @methods setToken 设置token - * @methods logOut 退出登录 - */ -export const useUserInfoStore = defineStore("routeList", { - state: (): any => ({ - account: { - username: "", - roles: [] - }, // 账号信息 - token: "" // token - }), - actions: { - async setAccount(data: Array) { - this.account = data; - }, - async setToken(data: string) { - this.token = data; - }, - async logOut() { - this.account = {}; - this.token = ""; - } - }, - persist: { - enabled: true // 开启数据缓存-默认缓存全部数据 - } -}); +import { defineStore } from "pinia"; + +/** + * 用户信息 + * @methods setAccount 设置账号信息 + * @methods setToken 设置token + * @methods logOut 退出登录 + */ +export const useUserInfoStore = defineStore("routeList", { + state: (): any => ({ + account: { + username: "", + roles: [] + }, // 账号信息 + token: "" // token + }), + actions: { + async setAccount(data: Array) { + this.account = data; + }, + async setToken(data: string) { + this.token = data; + }, + async logOut() { + this.account = {}; + this.token = ""; + } + }, + persist: { + enabled: true // 开启数据缓存-默认缓存全部数据 + } +});