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>
相关推荐
老前端的功夫12 小时前
TypeScript 类型守卫:从编译原理到高级模式
前端·javascript·架构·typescript
未来之窗软件服务13 小时前
幽冥大陆(七十二) 东方仙盟-在线IP归属地自己封装—东方仙盟练气期
前端·javascript·tcp/ip·仙盟创梦ide·东方仙盟·阿雪技术观
QT 小鲜肉13 小时前
【Linux命令大全】001.文件管理之mc命令(实操篇)
linux·运维·服务器·前端·笔记
ttod_qzstudio13 小时前
备忘录之事件监听器绑定陷阱:为什么 .bind(this) 会移除失败?
javascript·typescript·内存泄漏·事件监听
土豆_potato13 小时前
AI深度思考到底开不开
前端·aigc
ohyeah13 小时前
React 中的跨层级通信:使用 Context 实现主题切换功能
前端·react.js
winfredzhang13 小时前
打造专属桌面时钟:纯HTML实现的全功能动态时钟
前端·html·农历·生肖·周次
哥本哈士奇14 小时前
使用Gradio构建AI前端 - RAG的QA模块
前端·人工智能·状态模式
扶我起来还能学_14 小时前
Vue3 proxy 数据响应式的简单实现
前端·javascript·vue
Dragon Wu14 小时前
前端项目架构 项目格式化规范篇
前端·javascript·react.js·前端框架