什麼是 Element-UI ?
處理需求遇到技術問題
Element-UI Checkbox 有哪些坑?
處理方法
結論
Element-UI 是一套基於 Vue 框架的 UI 套件
el-Checkbox陣列使用物件:
el-Checkbox (全選) el-Checkbox-group (遊戲大類group) el-Checkbox (遊戲大類) el-Checkbox-group (遊戲商group) el-Checkbox (遊戲商)
let checkboxObject = [ {label: 'label', value: 'value'}, ]
el-checkbox(:label="checkboxObject.value") {{ checkboxObject.label }}
// 全選 handleCheckAllChange (boolen) { this.providerMapTag = boolen ? deepCopy(this.checkboxList) : { 1: [], 2: [], 3: [], 4: [], 5: [], 6: [] } this.checkCategory = boolen ? { 1: true, 2: true, 3: true, 4: true, 5: true, 6: true } : { 1: false, 2: false, 3: false, 4: false, 5: false, 6: false } this.isIndeterminateAll = false this.isIndeterminateCategory = { 1: false, 2: false, 3: false, 4: false, 5: false, 6: false } this.detailForm.providerMapTag = boolen ? true : [] },
// 遊戲大類 handleCategoryChange (boolen, index) { this.providerMapTag[index.num()] = boolen ? deepCopy(this.checkboxList[index]) : [] this.$set(this.isIndeterminateCategory, index, false) this.CheckAllJudge() this.providerMapTagVerify() },
// 遊戲商 handleOptionsChange (value, index) { let checkedCount = value.length let isAll = checkedCount === this.checkboxList[index].length let notAll = checkedCount > 0 && checkedCount < this.checkboxList[index].length this.$set(this.checkCategory, index, isAll) this.$set(this.isIndeterminateCategory, index, notAll) this.CheckAllJudge() this.providerMapTagVerify() },