vue elementui二维数组表格验证
html
ref="information" :model="information" :rules="rules"> table :data="information.slicingProcessList" > column width="200" label="生产数量" :render-header="addRedStar" > "scope"> item :prop="'slicingProcessList.' + scope.$index + '.calQuantity'" :rules="rules.calQuantity" > input v-model=" information.slicingProcessList[scope.$index].calQuantity " @input=" information.slicingProcessList[scope.$index].calQuantity = information.slicingProcessList[ scope.$index ].calQuantity.replace(/[^0-9]/g, '') " placeholder="请输入生产数量" maxlength="10" :min="1" />
js
rules: { calQuantity: [ { validator: validatorPositiveInteger, }, ], }, addRedStar(h, { column }) { // 给表头加必选标识 return [ h("span", { style: "color: red" }, "*"), h("span", " " + column.label), ]; },