1.0.2 • Published 2 years ago

waterfall-vue2 v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Waterfall

瀑布流组件

使用指南

import { Waterfall } from "waterfall-vue2";
Vue.use(Waterfall);

代码演示

基础用法

<Waterfall
  :pageData="pageData"
  :columnCount="2"
  :colStyle="{display:'flex',flexDirection:'column',alignItems:'center'}"
  query-sign="#cardItem"
  @wfLoad="onLoad"
  @ObserveDataTotal="ObserveDataTotal"
>
  <template #default="{ item, columnIndex, index}">
    <!--  slot 内容  good-card:事例组件 -->
    <good-card :item="item" id="cardItem" />
  </template>
</Waterfall>
export default {
  name: 'waterfall-demo',
  data() {
    return {
      pageData: []
    };
  },
  methods: {
    onLoad() {
        // 数据请求
        const data = request(....)
        // 当前页的数据
        this.pageData =data;
    },
     ObserveDataTotal(length) {
      console.log(length);
    }
  }
}

API

参数说明类型默认值版本
columnCount列数Number2-
pageData当前 pageIndex 请求的数据(非多页累加数据)Array[]-
resetSign重置数据(清空每列数据)Booleanfalse-
immediateCheck立即检查Booleantrue-
offset触发加载的距离阈值,单位为pxString|Number300-
colStyle每列的样式Object{}-
querySign内容标识(querySelectorAll选择器)String必须项-

Event

事件名说明参数
wfLoad滚动条与底部距离小于 offset 时触发-
ObserveDataTotal未渲染的数据总数length

Slot

名称说明
default插槽内容
columnIndex当前内容所在的列
item单条数据
index当前数据所在列的下标

源码地址

源码地址请参见 github