我想并排放3个输入. 我有一个如下代码,在每次迭代中,我想要三个组件并排. 可能吗? { this.state.features.length 0 ? this.state.features.map((feature) = { return ( div BooleanInput key={feature} source={this.ass
我有一个如下代码,在每次迭代中,我想要三个组件并排.
可能吗?
{ this.state.features.length > 0 ? this.state.features.map((feature) => { return ( <div> <BooleanInput key={feature} source={this.assignIsFeatureActiveProp(feature)} label={feature} /> <DisabledInput source="id" label="Value" defaultValue={feature} /> <TextInput source={this.assignFeatureValueProp(feature)} label="Value" /> </div> ) }) : null }您可以传递样式道具,例如,使用以下样式.
style = {{display:’inline’,float:’left’,marginLeft:’20px’}}
上面的代码看起来像
{ this.state.features.length > 0 ? this.state.features.map((feature) => { return ( <div> <BooleanInput key={feature} source={this.assignIsFeatureActiveProp(feature)} label={feature} style={{ display: 'inline', float: 'left', marginLeft: '20px' }} /> <DisabledInput source="id" label="Value" defaultValue={feature} style={{ display: 'inline', float: 'left', marginLeft: '20px' }} /> <TextInput source={this.assignFeatureValueProp(feature)} label="Value" style={{ display: 'inline', float: 'left', marginLeft: '20px' }} /> </div> ) }) : null }