<div class="actual-score" :contenteditable="$route.params.mode === ‘edit‘" v-html="item.shijidefen" @input="changeVal($event)" @blur="verifyScore(item)" :class="{‘can-edit‘: $route.params.mode==‘edit‘&!item.isVerify}" ></div>
changeVal(e) { this.editValue = e.target.innerHTML; }, verifyScore(item) { let { subList } = item; let allScores = []; subList.forEach(subItem => { subItem.thirdList.forEach(thirdItem => { allScores.push(thirdItem.fufenzhi); }); }); if (!isPositiveInteger(this.editValue)) { this.$message({ type: ‘warning‘, message: ‘请输入正整数‘ }); return; } if (allScores.includes(this.editValue)) { Vue.set(item, ‘isVerify‘, true); } else { this.$message({ type: ‘warning‘, message: ‘实际得分包含于赋分值‘ }); Vue.set(item, ‘isVerify‘, false); } }
https://cloud.tencent.com/developer/ask/182315