diff --git a/CoreCms.Net.Uni-App/CoreShop/components/coreshop-page-content/coreshop-page-content.vue b/CoreCms.Net.Uni-App/CoreShop/components/coreshop-page-content/coreshop-page-content.vue new file mode 100644 index 00000000..013a4e51 --- /dev/null +++ b/CoreCms.Net.Uni-App/CoreShop/components/coreshop-page-content/coreshop-page-content.vue @@ -0,0 +1,53 @@ + + + \ No newline at end of file diff --git a/CoreCms.Net.Uni-App/CoreShop/components/coreshop-page/coreshop-page.vue b/CoreCms.Net.Uni-App/CoreShop/components/coreshop-page/coreshop-page.vue index 013a4e51..770e6903 100644 --- a/CoreCms.Net.Uni-App/CoreShop/components/coreshop-page/coreshop-page.vue +++ b/CoreCms.Net.Uni-App/CoreShop/components/coreshop-page/coreshop-page.vue @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/CoreCms.Net.Uni-App/CoreShop/core/hooks/index.ts b/CoreCms.Net.Uni-App/CoreShop/core/hooks/index.ts index 57e9de48..015a01b7 100644 --- a/CoreCms.Net.Uni-App/CoreShop/core/hooks/index.ts +++ b/CoreCms.Net.Uni-App/CoreShop/core/hooks/index.ts @@ -1,2 +1,3 @@ /** 系统配置 */ export * from './systemInfo'; +export * from './use-loading'; diff --git a/CoreCms.Net.Uni-App/CoreShop/core/hooks/use-loading.ts b/CoreCms.Net.Uni-App/CoreShop/core/hooks/use-loading.ts new file mode 100644 index 00000000..6c6213d1 --- /dev/null +++ b/CoreCms.Net.Uni-App/CoreShop/core/hooks/use-loading.ts @@ -0,0 +1,11 @@ +import { Ref } from "vue"; + +export function useLoadingFn, R>(fn : (...args : T) => Promise, loading : Ref) { + function wrapper(this, ...args : T) { + loading.value = true; + return new Promise((resolve, reject) => + Promise.resolve(fn.apply(this, args)).then(resolve).catch(reject) + ).finally(() => loading.value = false); + } + return wrapper; +} \ No newline at end of file diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/home/home.vue b/CoreCms.Net.Uni-App/CoreShop/pages/home/home.vue index fee2b800..2b799e76 100644 --- a/CoreCms.Net.Uni-App/CoreShop/pages/home/home.vue +++ b/CoreCms.Net.Uni-App/CoreShop/pages/home/home.vue @@ -26,7 +26,7 @@