2.0.1 • Published 3 years ago
pic-waterfall v2.0.1
pic-waterfall
这是一款基于 vue2.x 的轻量级瀑布流插件
npm
npm install --save pic-waterfallcode
main.js:
import Vue from 'vue'
import imageView from 'pic-waterfall'
import 'pic-waterfall/dist/index.css'
Vue.use(imageView)template:
<template>
<div id="app">
<div>
<image-view :initData="initData" :width="375" :newList="newPicList" :accomplish="accomplish">
<template v-slot="{ item,index }">
<img class="img" :src="item.url" />
</template>
</image-view>
</div>
</div>
</template>API
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|---|---|---|---|---|
| initData | 初始化数据 | Array | [] | - |
| newList | 加载分页后的新数据 | Array | [] | - |
| width | 每一列宽度 | Number | 120 | - |
| space | 间距 | Number | 4 | - |
Event
| 事件名 | 说明 | 参数 |
|---|---|---|
| accomplish | 渲染完成后触发 | - |
Slot
| 名称 | 说明 |
|---|---|
| item | 单条数据 |
| index | 当前数据所在列的下标 |