import ich from '../car.jpg';
import mauri from '../mauri.png';
export class Home extends React.Component {
constructor() {
super();
this.state = {
checked: false,
bilder: [{car},{mauri}]
};
this.handleChange = this.handleChange.bind(this);
}
[...]
<Row>
{this.state.bilder.map((bild,i) =>
<Col xs={4} md={3} lg={3} key={i}>
<Image src={bild} key={i} thumbnail />
</Col>
)}
</Row>
答案 0 :(得分:0)
您可以阅读here如何正确使用所需的图像:
this.state = {
checked: false,
bilder: ["../car.jpg", "../mauri.png"]
};
this.handleChange = this.handleChange.bind(this);
}
对于组件:
<Row>
{this.state.bilder.map((bild,i) =>
<Col xs={4} md={3} lg={3} key={i}>
<Image src={require(bild)} key={i} thumbnail />
</Col>
)}
</Row>
答案 1 :(得分:-1)