Open ray0324 opened 4 months ago
提问前先看看:
https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md
renderFormItem中应该如何正确消费request返回的数据? 以下代码能正常运行 ,但是TS报错
{ title: '分配菜单', dataIndex: 'menus', valueType: 'option', hideInTable: true, hideInSearch: true, formItemProps: { tooltip: '分配菜单', rules: [ { required: true, message: '选择菜单', }, ], }, request: async () => { console.log('request treeDataList:', treeDataList) return treeDataList; }, renderFormItem: (schema, config, form) => { const onCheck: TreeProps['onCheck'] = (checkedKeysValue) => { form.setFieldsValue({ menus: checkedKeysValue }); }; const keys = form.getFieldValue('menus') || []; return ( <ProFormItem colon={false} style={{ textAlign: 'right', marginBottom: 0 }} > <ProCard bordered style={{ borderColor: '#d9d9d9' }}> <Tree checkable onCheck={onCheck} checkedKeys={keys} treeData={config.option ||[]} autoExpandParent={true} /> </ProCard> </ProFormItem> ); }, },
提问前先看看:
https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md
🧐 问题描述
renderFormItem中应该如何正确消费request返回的数据? 以下代码能正常运行 ,但是TS报错
💻 示例代码
🚑 其他信息