我有一个jsx风格,看起来像这样:
let styles = {
appBarStyle: {
display: 'flex',
flexWrap: 'nowrap',
WebkitFlexFlow: 'nowrap',
flex: '1 1 0%',
alignItems: 'center',
justifyContent: 'space-between',
padding: '0',
margin: '0',
listStyle: 'none',
backgroundColor: '#00bcd4',
fontFamily: 'Roboto',
minHeight: '64px',
color: 'white',
fontSize: '2em',
margin: '0px',
padding: '0px',
width: '100%',
zIndex: '2',
position: 'static',
top: 'auto',
left: 'auto',
right: 'auto'
}
};
所以我有一些使用不变性助手的代码:
if (useFixedMenuBar) {
styles = update(styles, {
appBarStyle:{top: {$set: '0px'}},
appBarStyle:{left: {$set: '0px'}},
appBarStyle:{right: {$set: '0px'}},
appBarStyle:{position: {$set: 'fixed'}},
}
update
,和
position
fixed
,但是
top
,
left
,和
right
0px
--他们仍然准备
auto
我错过了什么?