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 小时前
pnpm 的 resolution-mode 配置 ( pnpm 的版本解析)
前端
伍哥的传说3 小时前
React 自定义Hook——页面或元素滚动到底部监听 Hook
前端·react.js·前端框架
麦兜*5 小时前
Spring Boot 集成Reactive Web 性能优化全栈技术方案,包含底层原理、压测方法论、参数调优
java·前端·spring boot·spring·spring cloud·性能优化·maven
Jinkxs5 小时前
JavaScript性能优化实战技术
开发语言·javascript·性能优化
知了一笑5 小时前
独立开发第二周:构建、执行、规划
java·前端·后端
UI前端开发工作室5 小时前
数字孪生技术为UI前端提供新视角:产品性能的实时模拟与预测
大数据·前端
Sapphire~5 小时前
重学前端004 --- html 表单
前端·html
TE-茶叶蛋6 小时前
Flutter、Vue 3 和 React 在 UI 布局比较
vue.js·flutter·react.js
Maybyy6 小时前
力扣242.有效的字母异位词
java·javascript·leetcode
遇到困难睡大觉哈哈6 小时前
CSS中的Element语法
前端·css