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>
相关推荐
C_心欲无痕2 小时前
前端实现水印的两种方式:SVG 与 Canvas
前端·安全·水印
尾善爱看海5 小时前
不常用的浏览器 API —— Web Speech
前端
美酒没故事°6 小时前
vue3拖拽+粘贴的综合上传器
前端·javascript·typescript
jingling5557 小时前
css进阶 | 实现罐子中的水流搅拌效果
前端·css
zhengxianyi5158 小时前
只需3句让Vue3 打包部署后通过修改配置文件修改全局变量——实时生效
vue.js·前后端分离·数据大屏·ruoyi-vue-pro优化
悟能不能悟8 小时前
前端上载文件时,上载多个文件,但是一个一个调用接口,怎么实现
前端
可问春风_ren9 小时前
前端文件上传详细解析
前端·ecmascript·reactjs·js
羊小猪~~9 小时前
【QT】--文件操作
前端·数据库·c++·后端·qt·qt6.3
晚风资源组10 小时前
CSS文字和图片在容器内垂直居中的简单方法
前端·css·css3
Miketutu11 小时前
Flutter学习 - 组件通信与网络请求Dio
开发语言·前端·javascript