type check failed for prop “value“. Expected String, Number, got Null.
vue项目渲染from表单的时候报错:type check failed for prop "value". Expected String, Number, got Null.这种情况大多出现在Select下拉框中,是由于渲染项目含有null,例如:<FormItem prop="inventorybbcClearanceCode" label="配置1210清关申报主体"><
·
vue项目渲染from表单的时候报错:
type check failed for prop "value". Expected String, Number, got Null.
这种情况大多出现在Select下拉框中,是由于渲染项目含有null,例如:
<FormItem prop="inventorybbcClearanceCode" label="配置1210清关申报主体">
<Select v-model="form.inventorybbcClearanceCode" clearable :disabled="disabled1210">
<Option v-for="(option, index) in clearanceCompanyList" :value="option.code" :key="index">
{{ option.merchantName }}
</Option>
</Select>
</FormItem>
后端返回数据如下:
可以看到渲染:value=“option.code”,有一项的code是null,这就不符合我们value的预期。
解决:
this.clearanceCompanyList = this.clearanceCompanyList.filter((item) => {
return item.code != undefined
})
```
更多推荐
已为社区贡献27条内容
所有评论(0)