更新记录

1.0.0(2026-07-27) 下载此版本

  • 首次发布通用瀑布流列表组件
  • 支持 #item 插槽自定义任意列表卡片
  • 支持最短列优先布局、图片异步回流
  • 支持下拉刷新、触底加载更多(防抖)
  • 兼容 H5、微信小程序、App-vue,支持 Vue2 / Vue3

平台兼容性

uni-app(4.16)

Vue2 Vue3 Chrome Safari app-vue app-nvue Android iOS 鸿蒙
微信小程序 支付宝小程序 抖音小程序 百度小程序 快手小程序 京东小程序 鸿蒙元服务 QQ小程序 飞书小程序 小红书小程序 快应用-华为 快应用-联盟

uni-app x(4.18)

Chrome Safari Android iOS 鸿蒙 微信小程序
× × × × × ×

其他

多语言 暗黑模式 宽屏模式
× ×

nny-pbl 通用瀑布流列表组件

适合商品、图文、笔记、相册等任意列表场景。通过 #item 插槽自定义卡片,支持下拉刷新、触底加载,兼容 H5 / 微信小程序 / App(vue),支持 Vue2 / Vue3

特性

  • 最短列优先布局,列数、间距可配置
  • #item 插槽适配任意列表卡片
  • 图片异步加载后自动回流,减少错位
  • 下拉刷新、触底加载更多(内置防抖)
  • 不写插槽时提供默认图文卡片
  • easycom 自动引入,拿来即用

安装

插件市场导入后目录:

uni_modules/nny-pbl

符合 easycom,可直接使用:

<nny-pbl />

也可手动引入:

import NnyPbl from '@/uni_modules/nny-pbl/components/nny-pbl/nny-pbl.vue'

基础用法

<template>
  <nny-pbl
    :list="list"
    :column="2"
    :column-gap="10"
    :row-gap="10"
    :padding="12"
    :loading="loading"
    :has-more="hasMore"
    enable-refresh
    :refreshing="refreshing"
    height="100vh"
    @loadmore="loadMore"
    @refresh="onRefresh"
    @item-click="onItemClick"
  >
    <template #item="{ item }">
      <view class="card">
        <image class="card-img" :src="item.image" mode="widthFix" lazy-load />
        <text class="card-title">{{ item.title }}</text>
      </view>
    </template>
  </nny-pbl>
</template>

<script>
export default {
  data() {
    return {
      list: [],
      loading: false,
      hasMore: true,
      refreshing: false,
      page: 1
    }
  },
  onLoad() {
    this.loadMore()
  },
  methods: {
    onRefresh() {
      this.refreshing = true
      this.page = 1
      this.hasMore = true
      this.fetchList(1).then((arr) => {
        this.list = arr
        this.page = 2
        this.hasMore = arr.length >= 10
        this.refreshing = false
      }).catch(() => {
        this.refreshing = false
      })
    },
    loadMore() {
      if (this.loading || !this.hasMore || this.refreshing) return
      this.loading = true
      this.fetchList(this.page).then((arr) => {
        this.list = this.list.concat(arr)
        this.page += 1
        if (arr.length < 10) this.hasMore = false
        this.loading = false
      }).catch(() => {
        this.loading = false
      })
    },
    fetchList(page) {
      // 换成你的接口
      return Promise.resolve([])
    },
    onItemClick(e) {
      console.log(e.item, e.index)
    }
  }
}
</script>

Props

参数 说明 类型 默认值
list 列表数据,建议每项带稳定 id Array []
column 列数 Number / String 2
columnGap 列间距(px) Number / String 10
rowGap 行间距(px) Number / String 10
padding 左右内边距(px) Number / String 10
paddingLeft 左内边距,不传则用 padding Number / String null
paddingRight 右内边距,不传则用 padding Number / String null
paddingTop 顶部内边距(px) Number / String 0
height 滚动区域高度,建议传明确值 String 100vh
keyField 唯一键字段名 String id
imageKey 默认卡片图片字段 String image
titleKey 默认卡片标题字段 String title
loading 是否加载中 Boolean false
hasMore 是否还有更多 Boolean true
enableRefresh 是否开启下拉刷新 Boolean false
refreshing 是否正在刷新(需双向控制) Boolean false
customRefresher 自定义刷新头(部分端支持) Boolean false
refresherBackground 刷新区域背景色 String #f3f1ee
refresherThreshold 下拉刷新触发距离 Number 60
lowerThreshold 距底部多少触发加载更多 Number 100
loadmoreThrottle 触底防抖间隔(ms) Number 800
loadingText 加载中文案 String 正在加载
noMoreText 没有更多文案 String 已经到底啦
emptyText 空状态文案 String 暂无内容
pullText 下拉提示文案 String 下拉刷新
refreshText 刷新中文案 String 正在刷新
loadMoreHint 可继续上拉提示 String 上拉加载更多

Slots

插槽 说明 作用域参数
header 列表顶部自定义内容 -
item 每一项卡片(核心) item / index / column
footer 底部状态区 loading / hasMore
empty 空数据状态 -
refresher 自定义下拉刷新头(需 customRefresher refreshing

Events

事件 说明 回调参数
loadmore 触底加载更多 -
refresh 下拉刷新 -
scroll 列表滚动 detail
item-click 点击某一项 { item, index, column }

Methods(ref)

this.$refs.pbl.relayout() // 手动重排(卡片高度二次变化时调用)

使用建议

  1. 每项尽量带稳定 id(或通过 keyField 指定字段)
  2. height 请传明确高度,如 100vhwindowHeight + 'px'
  3. 自定义卡片图片建议 mode="widthFix" + lazy-load
  4. 刷新结束后务必将 refreshing 设回 false
  5. 加载结束后务必将 loading 设回 false

平台兼容

平台 状态
H5
微信小程序
App-vue
Vue2 / Vue3
nvue ×

示例工程

导入本插件的演示项目后,可查看:

pages/index/index.vue

隐私说明

  • 本插件不申请系统权限
  • 本插件不采集任何数据
  • 本插件不包含广告

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件不采集任何数据

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT License

Copyright (c) 2026 nny-pbl

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

暂无用户评论。