uView IndexList 索引列表

通过折叠面板收纳内容区域

#平台差异说明

App(vue) App(nvue) H5 小程序

#基本使用

外层包裹一个index-list组件,锚点通过index-anchor组件传入,自定义列表内容通过index-item嵌套使用

  • nvue需要将index-anchor写在index-item的外部

  • 非nvue需要将index-anchor嵌套在index-item的内部

  • 可以通过index-list参数自定义索引字符列表

  • 需要监听页面的onPageScroll事件,将当前滚动条高度传入index-list组件

    <template> <u-index-list :index-list="indexList"> <template v-for="(item, index) in itemArr"> <u-index-anchor :text="indexList[index]"></u-index-anchor> <u-index-item> <u-index-anchor :text="indexList[index]"></u-index-anchor> <view class="list-cell" v-for="(cell, index) in item"> {{cell}} </view> </u-index-item> </template> </u-index-list> </template> <script> export default { data() { return { indexList: ["A", "B", "C"], itemArr: [ ['列表A1','列表A2','列表A3'], ['列表B1','列表B2','列表B3'], ['列表C1','列表C2','列表C3'] ] } } } </script> <style lang="scss" scoped> .list-cell { display: flex; box-sizing: border-box; width: 100%; padding: 10px 24rpx; overflow: hidden; color: #323233; font-size: 14px; line-height: 24px; background-color: #fff; } </style>
相关推荐
耀耀切克闹灬17 小时前
前端签章数据的模板处理
前端
用户68026590511917 小时前
全栈可观测性白皮书——实施、收益与投资回报率
javascript·后端·面试
掘金安东尼18 小时前
⏰前端周刊第 454 期(2026年2月16日-2月22日)
前端·javascript·面试
掘金安东尼18 小时前
⏰前端周刊第 453 期(2026年2月9日-2月15日)
前端·javascript·面试
Amumu1213818 小时前
CSS进阶导读
前端·css
Wcowin18 小时前
为Zensical添加 GitHub 仓库卡片
javascript·github·zensical
anyup18 小时前
uniapp开发的鸿蒙应用上架后,竟然月入4000+
前端·vue.js·harmonyos
无尽的沉默18 小时前
使用Thymeleaf配置国际化页面(语言切换)
前端·spring boot
代码老中医18 小时前
接手老项目的一个月,我重构了那个2000行的“祖传”React组件
前端
飘逸飘逸18 小时前
Autojs进阶前言
android·javascript