# tui-waterfall 瀑布流 会员组件

介绍

瀑布流:目前列数支持最大值为2。App端建议使用weex的waterfall组件,使用案例详见:ThorUI组件库->pages->index->productNvue。

注:uni-app端V2.1.0+版本对组件进行了调整,循环移至组件外部实现。

提示

列表中图片可以结合图片懒加载组件使用,可优先计算出图片高度,以达到最佳效果。

# 引入

# uni-app引入

第一种,手动引入(可全局引入)

import tuiWaterfall from "@/components/thorui/tui-waterfall/tui-waterfall.vue"
export default {
	components:{
		tuiWaterfall
	}
}

第二种,开启easycom组件模式,如果不了解如何配置,可先查看 官网文档 (opens new window)

# uni-app版本平台差异说明

App-Nvue App-vue H5 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
升级中 ✓(暂不支持使用在分包页面中)

# 微信小程序引入(可在app.json中全局引入)

{
  "usingComponents": {
    "tui-waterfall": "/components/thorui/tui-waterfall/tui-waterfall"
  }
}

# 代码演示

部分功能演示,具体可参考示例程序以及文档API。

伪瀑布流

通过 listData 属性设置列表数据(不建议一次性加载过多数据),注:uni-app端自V2.1.0版本对组件进行了调整,循环移至组件外部实现。

<!--uni-app-->
<tui-waterfall :listData="listData">
	<template v-slot:left="{ list }">
		<t-goods-item v-for="(entity,index) in list" :key="index" :entity="entity"></t-goods-item>
	</template>
	<template v-slot:right="{ list }">
		<t-goods-item v-for="(entity,index) in list" :key="index" :entity="entity"></t-goods-item>
	</template>
</tui-waterfall>

<!--微信小程序-->
<tui-waterfall listData="{{listData}}" generic:item="t-goods-item"></tui-waterfall>
计算列高度

通过 type 属性设置数据分组类型(1-简单左右分组,按顺序排列,伪瀑布流 2-计算左右容器高度进行分组), 通过 pageSize 属性设置每页数据条数(当总数据长度小于等于该数时表示第一页数据,刷新重置)。

<!--uni-app-->
<tui-waterfall :listData="listData" :type="2" :pageSize="10">
	<template v-slot:left="{ list }">
		<t-goods-item v-for="(entity,index) in list" :key="index" :entity="entity"></t-goods-item>
	</template>
	<template v-slot:right="{ list }">
		<t-goods-item v-for="(entity,idx) in list" :key="idx" :entity="entity"></t-goods-item>
	</template>
</tui-waterfall>

<!--微信小程序-->
<tui-waterfall listData="{{listData}}" type="{{2}}" pageSize="{{10}}" generic:item="t-goods-item"></tui-waterfall>

# Slots

注意:小程序端使用的是抽象节点,详见 (opens new window)

插槽名称 说明
left 瀑布流左侧内容,详细使用参考示例
right 瀑布流右侧内容,详细使用参考示例

# Props

属性名 类型 说明 默认值
listData Array 列表数据,不建议一次性加载过多数据 []
pageSize Number 每页数据条数(固定条数,与接口约定一致),当总数据长度小于等于该数时表示第一页数据,刷新重置 10
type Number 数据分组类型:1-简单左右分组,按顺序排列,伪瀑布流 2-计算左右容器高度进行分组 1
columnCount Number 瀑布流列数,目前支持最大值为2 2
columnGap String 列与列的间隙 10rpx
leftGap String 左侧和列表的间隙 0
rightGap String 右侧和列表的间隙 0
backgroundColor String 列表背景色,可使用渐变色 transparent
radius String 列表外层容器圆角值 0

# Events

事件名 说明 回调参数
- - -

# 预览

请以移动端效果为准,touch事件目前尚未在PC端做兼容。

# 特别说明

该组件为 会员组件,非开源内容,需开通会员才可获取使用。

# 线上程序扫码预览

ThorUI组件库 H5二维码 ThorUI示例
ThorUI组件库小程序码 H5二维码 ThorUI示例小程序码
Last Updated: 1/20/2024, 6:31:45 PM