123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- import {
- Cell,
- CellGroup,
- Skeleton,
- SkeletonAvatar,
- SkeletonParagraph
- } from 'vant';
- import { defineComponent, onMounted, reactive, watch } from 'vue';
- import styles from './index.module.less';
- export default defineComponent({
- name: 'skeleton-modal',
- props: {
- show: {
- type: Boolean,
- default: false
- },
- showCount: {
- type: Array,
- default: () => [1, 2, 3, 4, 5]
- }
- },
- setup(props, { slots }) {
- const forms = reactive({
- loading: false
- });
- onMounted(() => {
- forms.loading = props.show;
- });
- watch(
- () => props.show,
- () => {
- forms.loading = props.show;
- }
- );
- return () => (
- <Skeleton loading={forms.loading} style="flex-wrap: wrap">
- {{
- template: () => (
- <div
- style={{
- height: `calc(100vh - var(--header-height))`,
- overflow: 'hidden',
- width: '100%'
- }}>
- {props.showCount.map(() => (
- <CellGroup inset class={styles.lessonCellGroup}>
- <Cell center class={styles.timeCell}>
- {{
- title: () => <SkeletonParagraph rowWidth={'40%'} />,
- value: () => <SkeletonParagraph rowWidth={'40%'} />
- }}
- </Cell>
- <Cell center border={false} valueClass={styles.skeletonClass}>
- {{
- icon: () => <SkeletonAvatar class={styles.iconStudent} />,
- title: () => (
- <div class={styles.userInfo}>
- <SkeletonParagraph
- class={styles.name}
- rowWidth={'40%'}
- />
- <SkeletonParagraph
- class={styles.subject}
- rowWidth={'50%'}
- />
- </div>
- ),
- value: () => (
- <SkeletonParagraph
- class={styles.people}
- rowWidth={'40%'}
- />
- )
- }}
- </Cell>
- <Cell center class={styles.musicCell}>
- {{
- title: () => (
- <SkeletonParagraph
- class={styles.musicInfo}
- rowWidth={'40%'}
- style={{ marginTop: '10px' }}
- />
- ),
- label: () => (
- <SkeletonParagraph
- class={styles.rowGroup}
- rowWidth={'80%'}
- />
- )
- }}
- </Cell>
- </CellGroup>
- ))}
- </div>
- ),
- default: () => slots.default && slots.default()
- }}
- </Skeleton>
- );
- }
- });
|