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>
相关推荐
明月_清风2 小时前
打字机效果优化:用 requestAnimationFrame 缓冲高频文字更新
前端·javascript
明月_清风2 小时前
Markdown 预解析:别等全文完了再渲染,如何流式增量渲染代码块和公式?
前端·javascript
掘金安东尼2 小时前
用 CSS 打造完美的饼图
前端·css
掘金安东尼10 小时前
纯 CSS 实现弹性文字效果
前端·css
牛奶10 小时前
Vue 基础理论 & API 使用
前端·vue.js·面试
牛奶10 小时前
Vue 底层原理 & 新特性
前端·vue.js·面试
anOnion11 小时前
构建无障碍组件之Radio group pattern
前端·html·交互设计
pe7er11 小时前
状态提升:前端开发中的状态管理的设计思想
前端·vue.js·react.js
SoaringHeart12 小时前
Flutter调试组件:打印任意组件尺寸位置信息 NRenderBox
前端·flutter
晚风予星12 小时前
Ant Design Token Lens 迎来了全面升级!支持在 .tsx 或 .ts 文件中直接使用 Design Token
前端·react.js·visual studio code