这是一种添加内嵌样式的方法!重要的超控?
style={
height: 20+'!important'
};
<div style={style}></div>
这并不像我希望的那样有效.
这是一种添加内嵌样式的方法!重要的超控?
style={
height: 20+'!important'
};
<div style={style}></div>
这并不像我希望的那样有效.
20+'!important'
等于'20!important'
.
当你只给出一个数字时,react会为你添加"px";但是你使用的是字符串,所以你必须指定单位.而且我很确定在"!important"和它左边的任何东西之间需要有一个空格.
style={{ height: '20px !important' }};