初始化uni-app

This commit is contained in:
liwentao committed 2026-06-11 14:26:48 +08:00
1 parent 7a94145819
commit 8d56fc8e9e
18 files changed
+988 -145

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
import { createPinia } from 'pinia'
const pinia = createPinia()
export default pinia
+27
View File
@@ -0,0 +1,27 @@
import { defineStore } from 'pinia'
export const useUserStore = defineStore('user', {
state: () => ({
token: '',
userInfo: null
}),
getters: {
isLoggedIn: (state) => !!state.token
},
actions: {
setToken(token) {
this.token = token
},
setUserInfo(userInfo) {
this.userInfo = userInfo
},
logout() {
this.token = ''
this.userInfo = null
}
}
})