cashier_wx/store/index.js

26 lines
468 B
JavaScript

// 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]
},
}
});