diff --git a/src/App.vue b/src/App.vue index 687d2ec..8afecc9 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,9 +1,17 @@ diff --git a/src/main.ts b/src/main.ts index d212212..266529a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -13,6 +13,7 @@ import 'vant/lib/index.css' import { Locale } from 'vant'; import enUS from 'vant/es/locale/lang/en-US'; Locale.use('en-US', enUS); +import { Loading } from 'vant'; import flexible from "./utils/flexible.js"; @@ -32,6 +33,7 @@ document.addEventListener('touchend', function(event) { const app = createApp(App) app.use(router) .use(store) +.use(Loading) .component("SvgIcon", SvgIcon) .mount('#app') diff --git a/src/stores/index.ts b/src/stores/index.ts index ca31d10..e8fe839 100644 --- a/src/stores/index.ts +++ b/src/stores/index.ts @@ -5,4 +5,5 @@ const store = createPinia() // 使用持久化插件(全局持久化) store.use(createPersistedState()) export default store -export * from './modules/generate' \ No newline at end of file +export * from './modules/generate' +export * from './modules/overall' diff --git a/src/stores/modules/overall.ts b/src/stores/modules/overall.ts new file mode 100644 index 0000000..7689f34 --- /dev/null +++ b/src/stores/modules/overall.ts @@ -0,0 +1,19 @@ +// 每一个存储的模块,命名规则use开头,store结尾 +import { defineStore } from 'pinia' +export const useOverallStore = defineStore({ + id: 'overall', // 必须指明唯一的pinia仓库的id + state: () => { + return { + loading:false, + } + }, + getters: { + // doubleCount: (state) => state.num * 2 + }, + actions: { + // 全局loading + setLoading(data:boolean){ + this.loading = data + } + } +})