gpt4 book ai didi

reactjs - 如何组合多个内联样式对象?

转载 作者:行者123 更新时间:2023-12-03 12:52:14 26 4
gpt4 key购买 nike

在 React 中,你可以清楚地创建一个对象并将其指定为内联样式。即下面提到的。

var divStyle = {
color: 'white',
backgroundImage: 'url(' + imgUrl + ')',
WebkitTransition: 'all', // note the capital 'W' here
msTransition: 'all' // 'ms' is the only lowercase vendor prefix
};

var divStyle2 = {fontSize: '18px'};

React.render(<div style={divStyle}>Hello World!</div>, mountNode);

如何组合多个对象并将它们分配在一起?

最佳答案

如果您使用 React Native,则可以使用数组表示法:

<View style={[styles.base, styles.background]} />

查看我的详细blog post关于这个。

关于reactjs - 如何组合多个内联样式对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29979324/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com