初始化
This commit is contained in:
25
store/index.js
Normal file
25
store/index.js
Normal file
@@ -0,0 +1,25 @@
|
||||
// user.js
|
||||
import { defineStore } from 'pinia';
|
||||
export const useAppStore = defineStore('user', {
|
||||
state: () => {
|
||||
return {
|
||||
userInfo: {},
|
||||
isLogin: false,
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
app_userInfo: (state) => state.userInfo,
|
||||
app_isLogin: (state) => state.isLogin
|
||||
},
|
||||
|
||||
actions: {
|
||||
// 设置数据
|
||||
async setData(key,data){
|
||||
this[key] = data
|
||||
},
|
||||
// 获取数据
|
||||
getData(key){
|
||||
return this[key]
|
||||
},
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user