我在我的应用程序中使用来自BlueprintJS的控件,在输入框中有一个名为"small“的属性,它将类”.bp3-小“添加到其中,以降低fontsize和组件高度。但是,这在DateInput控件中似乎是不可用的。我尝试用以下方法手动添加类:
<DateInput className="bp3-small"
showActionsBar={true}
small={true}
closeOnSelection={true}
value={props.data[props.fieldId]}
onChange={(newDate) => {
props.mutator(props.fieldId, newDate)
}}
popoverProps={{ position: Position.BOTTOM }}
formatDate={ date => date.toLocaleString()}
parseDate={str => new Date(str)}
/>以及:
<DateInput className=".bp3-small"
showActionsBar={true}
small={true}
closeOnSelection={true}
value={props.data[props.fieldId]}
onChange={(newDate) => {
props.mutator(props.fieldId, newDate)
}}
popoverProps={{ position: Position.BOTTOM }}
formatDate={ date => date.toLocaleString()}
parseDate={str => new Date(str)}
/>但还是没有申请。我也尝试了添加风格,但仍然没有运气。
<DateInput style={{fontSize: "12px", height:"24px"}}
showActionsBar={true}
small={true}
closeOnSelection={true}
value={props.data[props.fieldId]}
onChange={(newDate) => {
props.mutator(props.fieldId, newDate)
}}
popoverProps={{ position: Position.BOTTOM }}
formatDate={ date => date.toLocaleString()}
parseDate={str => new Date(str)}
/>如何在所有BlueprintJS组件中使用小样式?
我应该补充一点,我的DateInput在FormGroup中。我也尝试过使用contentClassName属性FormGroup,但没有成功。
谢谢你,特洛伊
发布于 2019-03-03 16:02:40
啊,我找到那只蚂蚁了。有一个名为inputProps的参数,它将属性传递给底层输入,因此这是可行的:
inputProps={{small: true}}https://stackoverflow.com/questions/54970127
复制相似问题