怎么做展开和收缩

时间:2019-06-18 16:30:30   收藏:0   阅读:85

技术分享图片
1.首先在data里面去定义
data () {
const showList = [0, 1, 2, 3, 4, 5]
return {
showList
}
}

  1. 技术分享图片

   switchBox (boxIndex) {
        let index = this.showList.indexOf(boxIndex)
        if (index >= 0) {
          this.showList.splice(index, 1)
        } else {
          this.showList.push(boxIndex)
        }
      },

这种写法真的很棒的,同事写的

原文:https://www.cnblogs.com/antyhouse/p/11045867.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!