当前位置: 代码迷 >> 综合 >> uView 折叠面板显示,绑定默认显示
  详细解决方案

uView 折叠面板显示,绑定默认显示

热度:11   发布时间:2023-09-19 07:46:33.0

u-collapse-item open属性默认为单个数据,直接使用:open=“index”,会使面板变成手风琴效果

即使accordion为false 也是一样,需要保存折叠面板索引为数组,再判断:open="current.indexOf(i) > -1",是否在数组中

changeBox(obj,index){changeBox(obj,index){// 查询到的数组下标let subscript = this.current.indexOf(index);if( subscript < 0){this.current.push(index);}else{this.current.splice(subscript,1);}}

  点击折叠判断是否有数据,进行加减数组