vue 骨架屏组件_关于骨架屏幕加载玩具砖的Vue组件

TB-Skeleton是一款基于Vue的骨架屏组件,用于页面加载时显示玩具砖样式的效果。用户可以通过npm安装或直接使用cdn。组件提供多种使用方式,包括设置通用属性和使用网格布局。还提供了现场示例和详细的道具配置说明。
摘要由CSDN通过智能技术生成

vue 骨架屏组件

TB骨架 (tb-skeleton)

a vue component about toy bricks of skeleton screen loading.

关于骨架屏幕加载的玩具积木的vue组件。

安装 (install)

$ npm i tb-skeleton -s

使用npm (use npm)

import Vue from 'Vue'
  import skeleton from 'tb-skeleton'
  import  'tb-skeleton/dist/skeleton.css'
  Vue.use(skeleton)

使用cdn (use cdn)

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/tb-skeleton.js"></script>
<link ref="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/skeleton.css"></script>

现场例子 (live example)

simple demo, page demo

简单演示页面演示

开始 (start)

<template>
  <div width="20%">
    <tb-skeleton :aspect-ratio="1" :theme="opacity" :shape="circle"></tb-skeleton>
  </div>
</template>
<script>
</script>

使用骨架 (use skeleton)

use skeleton component, you can set common props

使用骨架组件,可以设置通用道具

<template>
  <div>
    <skeleton :theme="opacity" :shape="radius" :bg-color="#dcdbdc">
     <tb-skeleton  width="30%" :aspect-ratio="1"  :shape="circle" :bg-color="#eee"></tb-skeleton>
     <tb-skeleton  width="30%" :aspect-ratio=".3"></tb-skeleton>
     <tb-skeleton  width="30%" :aspect-ratio=".3"></tb-skeleton>
   </skeleton>
  </div>
</template>
<script>
  import {TbSkeleton,Skeleton} from 'tb-skeleton'
  export default {
    components: {
      TbSkeleton,
      Skeleton
    }
  }
</script>

使用网格布局 (use grid layout)

about grid layout,please see simple-grid

关于网格布局,请参阅简单网格

<template>
<skeleton theme="opacity" style="width:200px" shape="radius">
    <row>
      <col :span="8">
        <tb-skeleton :aspect-ratio="1" shape="circle">
        </tb-skeleton>
      </col>
      <col :span="16">
        <row>
          <col :span="12" style="padding-left: 10px;margin-top: 5px">
            <tb-skeleton :aspect-ratio="0.2"></tb-skeleton>
          </col>
          <col :span="24" style="padding-left: 10px;margin-top: 10px">
            <tb-skeleton :aspect-ratio="0.1"></tb-skeleton>
          </col>
          <col :span="24" style="padding-left: 10px;margin-top: 10px">
            <tb-skeleton :aspect-ratio="0.1"></tb-skeleton>
          </col>
        </row>
      </col>
    </row>
  </skeleton>
</template>
<script>
  import {Col,Row} from 'simple-grid'
  import {TbSkeleton,Skeleton} from 'tb-skeleton'
  export default {
    components: {
      tb-skeleton,
      skeleton,
      Col,
      Row
    }
  }
</script>

骨架组件 (skeleton Component)

道具 (props)

paramdescriptiontypedefault
themeopacity,gradient,flex-outer,flex-inner, normalStringnormal
shapetb-skeleton shape, circlerectradiusString
bgColortb-skeleton background-colorString
durationtb-skeleton animation durationString,Number
参数 描述 类型 默认
主题 opacitygradientflex-outer flex-innernormal 正常
形状 tb骨架形状, circlerectradius
bgColor tb骨架背景色
持续时间 TB骨骼动画持续时间 字符串,数字

tb骨架组件 (tb-skeleton Component)

道具 (props)

paramdescriptiontypedefault
themethe same as skeleton themeStringnormal
shapethe same as skeleton shapeStringrect
bgColorthe same as skeleton bgColorString#dcdcdc
aspectRatioratio about width,heightNumber1
heightthe tb-skeleton heightNumber,String
widththe tb-skeleton widthNumber,String100%
durationthe tb-skeleton animation durationString,Number
参数 描述 类型 默认
主题 与骨架主题相同 正常
形状 与骨架形状相同 直肠
bgColor 与骨骼bgColor相同 #dcdcdc
AspectRatio 宽高比 1个
高度 tb骨架高度 数字,字符串
宽度 tb骨架宽度 数字,字符串 100%
持续时间 tb骨骼动画的持续时间 字符串,数字

翻译自: https://vuejsexamples.com/a-vue-component-about-toy-bricks-of-skeleton-screen-loading/

vue 骨架屏组件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值