目录
Radio.Group defaultValue 不起作用,用value就可以了
initialValue 不生效
<Table rowClassName={(record,index)=>{return index==0?'td-class':''}} rowKey={v => v['enterpriseId']} pagination={
{
total,
pageSize:pageSize,
pageSizeOptions: ['5', '10', '20', '40'],
showSizeChanger: true,
// position:'bottomRight'
}
} columns={memberColumns} dataSource={memberDataSource} onRow={(record,rowkey)=>{
return{
onClick : this.handleTableClick.bind(this,record,rowkey) //点击行 record 指的本行的数据内容,rowkey指的是本行的索引
}
}} />
//table 行实践
handleTableClick=(e,row,id)=>{
console.log('*********',e,row,id)
}
table报错
Warning: [antd: Table] Each record in dataSource of table should have a unique `key` prop, or set `rowKey` of Table to an unique primary key, see https://u.ant.design/table-row-key
<Table className='organ-table' columns={columns} dataSource={data} rowKey='id' />
Radio.Group defaultValue 不起作用,用value就可以了
<Radio.Group className="list" value={planClassValue.id} >
{planClassList&&planClassList.map((item,index)=>{
return(
<Radio.Button onClick={()=>{this.changeClass(item)}} key={item.id} value={item.id}>
{item.className}班{planClassValue.id},{item.id}
</Radio.Button>
)
})}
</Radio.Group>
antd 额外展开行 (expandedRowRender)使用的时候,当子集为空的时候,不显示下展开按钮(使用css方法隐藏)
table中添加
rowClassName={record => record.categoryListVoList && record.categoryListVoList.length === 0 && 'noExpand'}
css
.noExpand {
.ant-table-row-expand-icon {
display: none;
}
}
引用 https://blog.csdn.net/qq_34149935/article/details/82909395
父组件获取子组件的form值
在父组件中给子组件定义实例
<AddClassify id={id} categoryName={categoryName} wrappedComponentRef={ref => this.addPartner = ref} />
获取:
this.addPartner.props.form.validateFields(async (err, values) => {})
initialValue 不生效
如果getFieldDecorator中只有input,initialValue好用,如果外面包了一层如div之类的标签,那就需要在input 上面加一个defaultValue