如何解决Checkbox选中时查询Quantity为0的全部数据问题
"export const searchFormSchema: FormSchema[] = [ { label: "库存数量", field: "Quantity", component: "Checkbox", defaultValue: null, componentProps: { checkedValue: 0, // 复选框选中时的值 uncheckedValue: null, // 复选框未选中时的值 }, renderComponentContent: "库存为0", },报错,Field error in object "yfStocks" on field "quantity": rejected value [true],如何修改为当checkbox选中时,查询Quantity为0的全部数据内容:可以通过修改defaultValue的值来实现当checkbox选中时,查询Quantity为0的全部数据。将defaultValue修改为0即可。\n\n修改后的代码如下:\n\ntypescript\nexport const searchFormSchema: FormSchema[] = [\n {\n label: \"库存数量\",\n field: \"Quantity\",\n component: \"Checkbox\",\n defaultValue: 0, // 将defaultValue修改为0\n componentProps: {\n checkedValue: 0, // 复选框选中时的值\n uncheckedValue: null, // 复选框未选中时的值\n },\n renderComponentContent: \"库存为0\",\n },\n];\n\n\n这样,当checkbox选中时,查询Quantity为0的全部数据。
原文地址: https://www.cveoy.top/t/topic/qr78 著作权归作者所有。请勿转载和采集!