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>
相关推荐
菌菌的快乐生活几秒前
在 WPS 中设置 “第一章”“第二章” 这类一级编号标题自动跳转至新页面
前端·javascript·wps
hh随便起个名26 分钟前
useRef和useState对比
前端·javascript·react
Hello_Embed33 分钟前
LVGL 入门(十五):接口优化
前端·笔记·stm32·单片机·嵌入式
huabiangaozhi1 小时前
spring-boot-starter和spring-boot-starter-web的关联
前端
umeelove351 小时前
Spring boot整合quartz方法
java·前端·spring boot
吴声子夜歌1 小时前
JavaScript——对象
开发语言·javascript·ecmascript
小码哥_常1 小时前
Android 开发探秘:View.post()为何能获取View宽高
前端
爱学习的程序媛1 小时前
【Web前端】WebAssembly详解
前端·web·wasm
不会写DN1 小时前
Js常用的字符串处理
开发语言·前端·javascript
晓13131 小时前
第三章 TypeScript 高级类型
前端·javascript·typescript