refactor: 优化pinia setup store组合式函数写法
Former-commit-id: 27347ede51d0952d3422c3a6c3a86652f91e5639
This commit is contained in:
@@ -1,15 +1,11 @@
|
||||
import useUserStore from './modules/user';
|
||||
import useAppStore from './modules/app';
|
||||
import usePermissionStore from './modules/permission';
|
||||
import useSettingStore from './modules/settings';
|
||||
import useTagsViewStore from './modules/tagsView';
|
||||
import type { App } from 'vue';
|
||||
import { createPinia } from 'pinia';
|
||||
|
||||
const useStore = () => ({
|
||||
user: useUserStore(),
|
||||
app: useAppStore(),
|
||||
permission: usePermissionStore(),
|
||||
setting: useSettingStore(),
|
||||
tagsView: useTagsViewStore()
|
||||
});
|
||||
const store = createPinia();
|
||||
|
||||
export default useStore;
|
||||
// 全局挂载store
|
||||
export function setupStore(app: App<Element>) {
|
||||
app.use(store);
|
||||
}
|
||||
|
||||
export { store };
|
||||
|
||||
Reference in New Issue
Block a user