关于在 React 中使用卡片的几个问题。
首先,根据下面的代码,为什么这 4 张卡不能并排放置?我忘了申请什么吗?
import React, { Component } from "react";
import { Container, Card, CardText, CardImg, CardBody, CardLink,
CardTitle, Button, Col, Row } from 'reactstrap';
class Users extends Component {
render() {
return (
<div>
<Container>
<Row>
<Col>
<Card>
<CardImg top width="25%" src="https://placeholdit.imgix.net/~text?txtsize=33&txt=318%C3%97180&w=318&h=180" alt="Card image cap" />
<CardBody>
<CardTitle>Need Help Finding Customers?</CardTitle>
<CardText>Some quick example text to build on the card title and make up the bulk of the card's content.</CardText>
<Button>Button</Button>
</CardBody>
</Card>
</Col>
<Col>
<Card>
<CardImg top width="25%" src="https://placeholdit.imgix.net/~text?txtsize=33&txt=318%C3%97180&w=318&h=180" alt="Card image cap" />
<CardBody>
<CardTitle>Get help with a Moneyball activity!</CardTitle>
<CardText>Some quick example text to build on the card title and make up the bulk of the card's content.</CardText>
<Button>Button</Button>
</CardBody>
</Card>
</Col>
<Col>
<Card>
<CardImg top width="25%" src="https://placeholdit.imgix.net/~text?txtsize=33&txt=318%C3%97180&w=318&h=180" alt="Card image cap" />
<CardBody>
<CardTitle>Request Moneyball in-person training</CardTitle>
<CardText>Some quick example text to build on the card title and make up the bulk of the card's content.</CardText>
<Button>Button</Button>
</CardBody>
</Card>
</Col>
<Col>
<Card>
<CardImg top width="25%" src="https://placeholdit.imgix.net/~text?txtsize=33&txt=318%C3%97180&w=318&h=180" alt="Card image cap" />
<CardBody>
<CardTitle>Register for an Immerse Event</CardTitle>
<CardText>Some quick example text to build on the card title and make up the bulk of the card's content.</CardText>
<Button>Button</Button>
</CardBody>
</Card>
</Col>
</Row>
</Container>
</div>
);
}
}
export default Users;
我得到的是:
此外,通过我在网上看到的示例,我喜欢卡片的概念,但更愿意将整个卡片制作成一个大按钮。在 React 中,有哪些最佳实践?
非常感谢。