Skip to content

Commit a5dc039

Browse files
author
issayah
committed
BSkeleton script setup conversion
1 parent 4eb2dd7 commit a5dc039

File tree

5 files changed

+51
-23
lines changed

5 files changed

+51
-23
lines changed

src/components/BSkeleton/BSkeleton.vue

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,22 @@
33
</template>
44

55
<script setup lang="ts">
6-
import {computed, PropType, StyleValue} from 'vue'
7-
import type {ColorVariant, SkeletonAnimation, SkeletonType} from '../../types'
6+
// import type {BSkeletonProps} from '@/types/components'
7+
import {computed, StyleValue} from 'vue'
8+
import type {ColorVariant, SkeletonAnimation, SkeletonType} from '@/types'
89
9-
const props = defineProps({
10-
animation: {type: String as PropType<SkeletonAnimation>, default: 'wave'},
11-
height: {type: String},
12-
size: {type: String},
13-
type: {type: String as PropType<SkeletonType>, default: 'text'},
14-
variant: {type: String as PropType<ColorVariant>},
15-
width: {type: String},
10+
interface BSkeletonProps {
11+
height?: string
12+
width?: string
13+
size?: string
14+
animation?: SkeletonAnimation
15+
type?: SkeletonType
16+
variant?: ColorVariant
17+
}
18+
19+
const props = withDefaults(defineProps<BSkeletonProps>(), {
20+
animation: 'wave',
21+
type: 'text',
1622
})
1723
1824
const classes = computed(() => [

src/components/BSkeleton/BSkeletonIcon.vue

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@
88
</template>
99

1010
<script setup lang="ts">
11-
import {computed, PropType} from 'vue'
12-
import type {SkeletonAnimation} from '../../types'
11+
// import type {BSkeletonIconProps} from '@/types/components'
12+
import {computed} from 'vue'
13+
import type {SkeletonAnimation} from '@/types'
1314
14-
const props = defineProps({
15-
animation: {type: String as PropType<SkeletonAnimation>, default: 'wave'},
15+
interface BSkeletonIconProps {
16+
animation?: SkeletonAnimation
17+
}
18+
19+
const props = withDefaults(defineProps<BSkeletonIconProps>(), {
20+
animation: 'wave',
1621
})
1722
1823
const classes = computed(() => [`b-skeleton-animate-${props.animation}`])

src/components/BSkeleton/BSkeletonTable.vue

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,25 @@
2525
</template>
2626

2727
<script setup lang="ts">
28+
// import type {BSkeletonTableProps} from '@/types/components'
29+
import type {SkeletonAnimation} from '@/types'
2830
import BTableSimple from '../BTable/BTableSimple.vue'
2931
import BSkeleton from './BSkeleton.vue'
3032
31-
defineProps({
32-
animation: {type: String, default: 'wave'},
33-
columns: {type: Number, default: 5},
34-
hideHeader: {type: Boolean, default: false},
35-
rows: {type: Number, default: 3},
36-
showFooter: {type: Boolean, default: false},
37-
tableProps: {type: Object},
33+
interface BSkeletonTableProps {
34+
animation?: SkeletonAnimation
35+
columns?: number
36+
hideHeader?: boolean
37+
rows?: number
38+
showFooter?: boolean
39+
tableProps: Record<string, unknown>
40+
}
41+
42+
withDefaults(defineProps<BSkeletonTableProps>(), {
43+
animation: 'wave',
44+
columns: 5,
45+
hideHeader: false,
46+
rows: 3,
47+
showFooter: false,
3848
})
3949
</script>

src/components/BSkeleton/BSkeletonWrapper.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44
</template>
55

66
<script setup lang="ts">
7-
defineProps({
8-
loading: {type: Boolean, default: false},
7+
// import type {BSkeletonWrapperProps} from '@/types/components'
8+
9+
interface BSkeletonWrapperProps {
10+
loading?: boolean
11+
}
12+
13+
withDefaults(defineProps<BSkeletonWrapperProps>(), {
14+
loading: false,
915
})
1016
</script>

src/types/components/BSkeleton/BSkeletonTable.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import type {SkeletonAnimation} from '@/types'
12
// Props
23
export interface Props {
3-
animation?: string
4+
animation?: SkeletonAnimation
45
columns?: number
56
hideHeader?: boolean
67
rows?: number

0 commit comments

Comments
 (0)