Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Vant Skeleton skeleton screen


May 07, 2021 Vant


Table of contents


Introduced

import Vue from 'vue';
import { Skeleton } from 'vant';

Vue.use(Skeleton);

Code demo

Basic usage

The title placemap is displayed through the title property, and the number of placeholder paragraph lines is configured by the row property

<van-skeleton title :row="3" />

Show the avatar

The avatar placemap is displayed through the avatar property

<van-skeleton title avatar :row="3" />

Show sub-components

Setting the loading property to false indicates that the content is loaded, where the placemap is hidden and Skeleton's sub-components are displayed

<van-skeleton
  title
  avatar
  :row="3"
  :loading="loading"
>
  <div>实际内容</div>
</van-skeleton>
export default {
  data() {
    return {
      loading: true
    }
  },
  mounted() {
    this.loading = false;
  }
};

Api

Props

Parameters Description Type The default
row The number of paragraph placemap lines number | string 0
row-width Paragraph placemap width, you can pass an array to set the width of each line number | string |
(number | string) []
100%
title Whether to display the title placemap boolean false
avatar Whether to display the avatar placemap boolean false
loading Whether or not the skeleton screen is displayed, the false content is displayed when false is passed boolean true
animate Whether to turn on the animation boolean true
title-width The title placemap width number | string 40%
avatar-size The size of the avatar placemap number | string 32px
avatar-shape The avatar placeholder shape, with an optional value of square string round


Example demonstration