1.1.2 • Published 5 years ago

vue-skeleton-component v1.1.2

Weekly downloads
814
License
ISC
Repository
github
Last release
5 years ago

这是一款通用的vue骨架屏插件

使用方法

npm install vue-skeleton-component --save-dev

// main.js
import skeleton from 'vue-skeleton-component'
Vue.use(skeleton)

骨架屏样式

初期版本只提供几个简单的样式可以选择,后续会慢慢补充

1. 分割线

以给定的容器大小为基准画一条线 image.png

<skeleton active type='straightLine' :options="{
    height: '20px',
    position: 'center'
}" />
API内容类型
type显示类型String组件类型
active是否显示动效Booleantrue/false
options设置项Objectnull
width线的长度String100%
height线的宽度String100%
position线的位置String'top', 'center', 'end'

2. 圆

画一个圆 image.png

<skeleton  type='circlecom' active :options="{
    width: '150px'
}" />
API内容类型
type显示类型String组件类型
active是否显示动效Booleantrue/false
options设置项Objectnull
width圆的直径String100%,如果不传,将会自动使用100%

3. 卡片

画一个方块 image.png

<skeleton type='card' active :options="{
    width: '200px',
    height: '150px'
}" />
API内容类型
type显示类型String组件类型
active是否显示动效Booleantrue/false
options设置项Objectnull
width线的长度String100%
height线的宽度String100%

4. 列表

创建一个文字行效果 image.png

<skeleton type='listcom' active :options="{
    row: 3,
    lineHight: 20
}" />
API内容类型
type显示类型String组件类型
active是否显示动效Booleantrue/false
options设置项Objectnull
row列表行数Number3
lineHight行间距Number20

5. 混合类型

混合类型可以使用以上几种类型的全部api,将其整合到一起,相互拼接 image.png

混合类型使用了九宫格布局来作为基础布局,将你想插入的组件按照a ~ i的顺序进行排列,你可以选择你想让那些组件出现在哪一个位置,简单配置,既可以达到想要的效果 image.png

<skeleton type="custom" :options="{ width: '100%', height: '100%' }" :childrenOption="[
    {type: 'circlecom', rules: 'a, d', active: true, options:{width: '150px'} },
    {type: 'listcom', rules: 'b, c, e, f', active: true},
    {type: 'straightLine', active: true, rules: 'g, h, i'},
]" />
API内容类型
type显示类型String组件类型
active是否显示动效Booleantrue/false
options设置项Objectnull
rules出现规则,这里不可以跨行切必须相邻String'a, b, ... i'
childrenOption设置子组件类型ArrayObject[]
1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago