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
})
```
Logo

前往低代码交流专区

更多推荐