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>
相关推荐
老前端的功夫1 分钟前
【Java从入门到入土】21:List三剑客:ArrayList、LinkedList、Vector的爱恨情仇
java·javascript·网络·python·list
小李云雾5 分钟前
零基础-从ESS6基础到前后端联通实战
前端·python·okhttp·中间件·eclipse·html·fastapi
SAP小崔说事儿9 分钟前
SAP B1 批量应用用户界面配置模板
java·前端·ui·sap·b1·无锡sap
Amos_Web19 分钟前
Rspack 源码解析 (1) —— 架构总览:从 Node.js 到 Rust 的跨界之旅
前端·rust·node.js
qq_4061761419 分钟前
React 组件传参 & 路由跳转传参
前端·javascript·react.js
电商API&Tina19 分钟前
唯品会数据采集API接口||电商API数据采集
java·javascript·数据库·python·sql·json
Csvn24 分钟前
React 测试入门:Jest + Testing Library 完整指南
前端·react.js
悟空瞎说26 分钟前
Flutter面试九阳神功第六层:Platform Channels/三棵树/Key/动画,大白话+实操代码(2026版)
前端
Oneslide29 分钟前
手写签名组件实现原理
前端
Lufeidata42 分钟前
go语言学习记录-入门阶段
前端·学习·golang