按照这里的建议,尝试使用“zindex”属性:
https://github.com/facebook/react/issues/1456<Input ref="username" type="text" label="Username"
placeholder="Enter username" zindex={1} />
不起作用。尝试过 'zindex="1"'。
有任何想法吗?
按照这里的建议,尝试使用“zindex”属性:
https://github.com/facebook/react/issues/1456<Input ref="username" type="text" label="Username"
placeholder="Enter username" zindex={1} />
不起作用。尝试过 'zindex="1"'。
有任何想法吗?
你需要使用 style={} 结构来分配它。 试试这个:
<Input ref="username" type="text" label="Username" placeholder="Enter username" style={{zIndex:1}} />
永远记得使用驼峰命名法。
z-index
变成 zIndex
。
margin-right
变成 marginRight
。
你必须调用样式。
style={{ zIndex = 1}}
你可能想传递相对或绝对。
<div style={{ position: 'relative', zIndex: '1' }}>
bottom
</div>
<div style={{ position: 'relative', zIndex: '2' }}>
top
</div>
<Input ref="username" type="text" label="Username" placeholder="Enter username" zindex={1} />
尝试这种方法...
style={{zIndex: '100'}}
!important
来强制应用你的样式。style={{ zIndex: '1 !important' }};
当你应用 z-index 时,肯定是在尝试优先处理你的新代码部分。因此,你还需要检查是否有任何其他具有更高值的 z-index 可能会限制你的新 z-index 值。
<Input ref="username" type="text" label="Username"
placeholder="Enter username" class = "applyZIndex" />
.applyZIndex {
z-index : 1;
}
style
prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX." - Blake