Skip to content

waterFall 瀑布流

瀑布流组件,用于展示一组等宽不等高的元素。

基础用法

通过 data 属性传递数据,组件内部会根据设置的 mode 模式将数据分割成左右两列数据,开发者通过 left 和 right 插槽自定义左右两边的内容样式 当 mode 设置为 normal 时,组件会将数据按照顺序分割成左右两列数据,当 mode 设置为 calc 时,组件会计算左右两列的高度的方式分割成左右两列数据

html
<template>
  <WuiWaterFall :data="imageData">
    <template #left="{ item }">
      <view class="image-data">
        <image class="image" :src="item.url" mode="widthFix" />
      </view>
    </template>
    <template #right="{ item }">
      <view class="image-data">
        <image class="image" :src="item.url" mode="widthFix" />
      </view>
    </template>
  </WuiWaterFall>
</template>

<style lang="scss">
  .image-data {
    width: calc(100% - 20rpx);
    margin: 10rpx;

    .image {
      width: 100%;
      height: auto;
    }
  }
</style>

Attributes

参数说明类型可选值默认值最低版本
data列表数据Array-''-
mode瀑布流模式Stringnormal/calc'normal'-

Slot

name说明最低版本
left瀑布流左边单个 item 的内容-
right瀑布流右边单个 item 的内容-

Methods

方法名说明参数最低版本
reset重置瀑布流列表--

源代码

文档
组件

Released under the MIT License.

Released under the MIT License.