怎么做展开和收缩
时间:2019-06-18 16:30:30
收藏:0
阅读:85

1.首先在data里面去定义
data () {
const showList = [0, 1, 2, 3, 4, 5]
return {
showList
}
}
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)
