From c454a16f04654178ff468e2a33f1f2f0ebaafec8 Mon Sep 17 00:00:00 2001 From: X1627315083 <1627315083@qq.com> Date: Thu, 23 Oct 2025 14:05:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E4=B9=89=E5=85=A8=E5=B1=80loding?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 22 +++++++++++++++++++++- src/main.ts | 2 ++ src/stores/index.ts | 3 ++- src/stores/modules/overall.ts | 19 +++++++++++++++++++ 4 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 src/stores/modules/overall.ts 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 + } + } +})