我从网址中提取了这张图片:
我正在使用以下代码在我的组件内将其显示为背景render()
:
字段.jsx
const { players } = this.props;
return (
<div className="back" style ={ { backgroundImage: "url('https://url.svg')" } }>
<div className="field-wrapper" >
<Output output={this.props.strategy} />
<div className="row"> {this.getPlayersByPosition(players, 5).map((player,i) => (
<Position key={i}>{player.name}</Position>))}
</div>
</div>
)
我错过了什么?
但是图像正在平铺,如下所示:
这是Field.css:
.back {
display: flex;
justify-content: center;
text-align: center;
align-items: center;
height: 100vh;
width: 100%;
}
.field-wrapper {
overflow: hidden;
width: 400px;
height: 600px;
}
.field-row {
display: flex;
flex-direction: row;
width: 100%;
}