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>
相关推荐
小二·8 分钟前
Vue 前端性能优化终极指南:Lighthouse 100 分实战(Vue 3 + Vite)
前端·vue.js·性能优化
LYFlied10 分钟前
深入解析服务端渲染(SSR):从原理到实践
前端·性能优化
用户9047066835711 分钟前
到底是用nuxt的public还是assets?一篇文章开悟
前端
技术人的流水账16 分钟前
我的Vide Coding工具的尝试——版本问题的苦之2
javascript
23级二本计科25 分钟前
前端 HTML + CSS + JavaScript
前端·css·html
踩着两条虫26 分钟前
VTJ.PRO「AI + 低代码」应用开发平台的后端模块系统
前端·人工智能·低代码
pany33 分钟前
程序员近十年新年愿望,都有哪些变化?
前端·后端·程序员
大鸡爪36 分钟前
基于PDF.js的安全PDF预览组件实现:从虚拟滚动到水印渲染
vue.js
朱昆鹏38 分钟前
IDEA Claude Code or Codex GUI 插件【开源自荐】
前端·后端·github
HashTang38 分钟前
买了专业屏只当普通屏用?解锁 BenQ RD280U 的“隐藏”开发者模式
前端·javascript·后端