reactjs – 在react-admin中并排输入
发布时间:2020-12-15 09:31:42 所属栏目:百科 来源:网络整理
导读:我想并排放3个输入. 我有一个如下代码,在每次迭代中,我想要三个组件并排. 可能吗? { this.state.features.length 0 ? this.state.features.map((feature) = { return ( div BooleanInput key={feature} source={this.assignIsFeatureActiveProp(feature)} l
我想并排放3个输入.
我有一个如下代码,在每次迭代中,我想要三个组件并排. 可能吗? { 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',marginLeft: '20px' }} /> <TextInput source={this.assignFeatureValueProp(feature)} label="Value" style={{ display: 'inline',marginLeft: '20px' }} /> </div> ) }) : null } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |