automated_uniapp/uni_modules/cool-ui/components/cl-skeleton/cl-skeleton.vue
2025-01-09 16:16:11 +08:00

40 lines
644 B
Vue

<template>
<view
class="cl-skeleton"
:class="{
'is-loading': loading,
}"
:style="[baseStyle, loading && loadingStyle]"
>
<view class="cl-skeleton__inner" v-show="!loading">
<slot></slot>
</view>
</view>
</template>
<script lang="ts">
import { type PropType, type StyleValue, defineComponent } from "vue";
import { useStyle } from "../../hooks";
export default defineComponent({
name: "cl-skeleton",
props: {
loading: {
type: Boolean,
default: true,
},
loadingStyle: {
type: Object as PropType<StyleValue>,
default: () => ({}),
},
},
setup() {
return {
...useStyle(),
};
},
});
</script>