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>
相关推荐
天若有情6731 天前
从语法拆分到用户感知:我的前端认知重构之路
前端·javascript
_OP_CHEN1 天前
【前端开发之CSS】(五)CSS 盒模型深度解析:从基础到实战,掌控页面布局核心
前端·css·html·盒模型·页面开发·页面布局·页面美化
摘星编程1 天前
用React Native开发OpenHarmony应用:DrawerNavigation侧滑关闭
javascript·react native·react.js
阿蒙Amon1 天前
TypeScript学习-第2章:基础类型
javascript·学习·typescript
轩情吖1 天前
Qt多元素控件之QListWidget
开发语言·前端·c++·qt·控件·qlistwidget·桌面级
Yaru111 天前
伪3D地图和3D饼图实现
前端·3d·echarts
测试_AI_一辰1 天前
Agent & RAG 测试工程 02:RAG 从最小闭环到可信
开发语言·前端·人工智能·github·ai编程
DreamOneDay1 天前
MapLibre GL JS加载ArcGis Terrain3D地形
javascript·3d·arcgis·maplibre·terrain3d
_xaboy1 天前
开源Vue组件-动态表单组件设计,告别重复CRUD,JSON一键生成表单
前端·vue.js·低代码·开源·json
POLITE31 天前
Leetcode 236. 二叉树的最近公共祖先 (Day 17) JavaScript
linux·javascript·leetcode