Skip to content

Commit

Permalink
feat: add common BaseSpin component
Browse files Browse the repository at this point in the history
  • Loading branch information
flingyp committed Jun 30, 2023
1 parent 88ea62c commit 3b9013e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export {}

declare module '@vue/runtime-core' {
export interface GlobalComponents {
BaseSpin: typeof import('./src/components/common/BaseSpin.vue')['default']
BaseTable: typeof import('./src/components/common/BaseTable.vue')['default']
BaseTableHandle: typeof import('./src/components/common/BaseTableHandle.vue')['default']
BaseTableSearch: typeof import('./src/components/common/BaseTableSearch.vue')['default']
Expand Down
27 changes: 27 additions & 0 deletions src/components/common/BaseSpin.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<script setup lang="ts">
defineProps({
size: {
type: String as PropType<number | 'small' | 'medium' | 'large'>,
default: 'medium',
},
isLoading: {
type: Boolean,
default: false,
},
loadingText: {
type: String,
default: '',
},
})
</script>

<template>
<NSpin
rotate
:size="size"
:show="isLoading"
:description="loadingText"
>
<slot />
</NSpin>
</template>
4 changes: 4 additions & 0 deletions src/composables/useLoading/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* Can configure the loading property of the BaseSpin component or the Button component to implement the Loading effect
* @returns
*/
export const useLoading = () => {
const isLoading = ref(false)

Expand Down

0 comments on commit 3b9013e

Please sign in to comment.