最近项目使用iview的table组件带checkbox选择框。iview的坑:(1)设置_check的属性为data。_checked属性影响复选框的选中状态。Buttheselectedstateofthecheckboxwillnotaffectthe_checkattribute(2)Theofficialiviewdocumentsays:@on-selection-change,itwillbetriggeredwhenevertheselecteditemchanges,andthereturnvalueisselection,selected.效果不是这样的,而是:用程序设置_checked=true后,事件不会被触发。on-select-cancel和on-select都不会被触发。只有再次用鼠标点击复选框,才会触发以上三个事件。虽然最后一个参数中的选择是正确的。要用程序切换一行的选中状态,需要调用函数this.$refs.xxx.toggleSelect(i)。调用该函数后,会触发on-select-cancel、on-select、on-selection-change事件。解决方法:根据selection,拆分已选项与未选项
