Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/418.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何打印React组件中的行和列_Javascript_Reactjs - Fatal编程技术网

Javascript 如何打印React组件中的行和列

Javascript 如何打印React组件中的行和列,javascript,reactjs,Javascript,Reactjs,我正在使用React with React Boostrap,我正在尝试找出如何将三张牌放在三列上,并在每次达到三张牌时添加一行新行。我似乎不明白如何打印一个新的行标记。据我所知,我不能以一种好的方式将条件包装在and标记周围。我怎样才能做到这一点 {items && items.map((item, index) => <Row>

我正在使用React with React Boostrap,我正在尝试找出如何将三张牌放在三列上,并在每次达到三张牌时添加一行新行。我似乎不明白如何打印一个新的行标记。据我所知,我不能以一种好的方式将条件包装在and标记周围。我怎样才能做到这一点

                 {items &&
                    items.map((item, index) =>
                    <Row>
                        <Col>
                            <Card style={{ width: '18rem' }}>
                            <Card.Img variant="top" src={item.logo}/>
                            <Card.Body>
                                <Card.Title>Card Title</Card.Title>
                                <Card.Text>
                                Some quick example text to build on the card title and make up the bulk of
                                the card's content.
                                </Card.Text>
                                <Button variant="primary">Go somewhere</Button>
                            </Card.Body>
                            </Card>
                        </Col>
                    </Row>
                    )
                    }
{items&&
items.map((项目,索引)=>
卡片标题
一些快速的示例文本构建在卡片标题上,并构成大部分
卡片的内容。
去某处
)
}

使用
显示:'grid'
gridTemplateColumns:'1fr 1fr 1fr'
可以更快、更干净地完成此操作

您必须将父级的
显示设置为
网格
,并将
网格模板列
设置为
1fr 1fr
,您将有一个表,每个表包含父级的一部分

您的代码如下所示:

<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr 1fr' }} >
    {items && items.map((item, index) =>
        <Card style={{ width: '18rem' }}>
            <Card.Img variant="top" src={item.logo} />
            <Card.Body>
                <Card.Title>Card Title</Card.Title>
                <Card.Text>
                    Some quick example text to build on the card title and make up the bulk of
                    the card's content.
                                    </Card.Text>
                <Button variant="primary">Go somewhere</Button>
            </Card.Body>
        </Card>
    )}
</div>

{items&&items.map((项目,索引)=>
卡片标题
一些快速的示例文本构建在卡片标题上,并构成大部分
卡片的内容。
去某处
)}

更多关于网格的信息

使用
显示:'grid'
gridTemplateColumns:'1fr 1fr 1fr'
可以更快、更清晰地完成此操作

您必须将父级的
显示设置为
网格
,并将
网格模板列
设置为
1fr 1fr
,您将有一个表,每个表包含父级的一部分

您的代码如下所示:

<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr 1fr' }} >
    {items && items.map((item, index) =>
        <Card style={{ width: '18rem' }}>
            <Card.Img variant="top" src={item.logo} />
            <Card.Body>
                <Card.Title>Card Title</Card.Title>
                <Card.Text>
                    Some quick example text to build on the card title and make up the bulk of
                    the card's content.
                                    </Card.Text>
                <Button variant="primary">Go somewhere</Button>
            </Card.Body>
        </Card>
    )}
</div>

{items&&items.map((项目,索引)=>
卡片标题
一些快速的示例文本构建在卡片标题上,并构成大部分
卡片的内容。
去某处
)}

更多关于网格的信息

您可以使用引导网格执行类似操作

通过在每行中放置3列,引导网格将在第三列之后的每个新列中打断该列


{项目&&
items.map((项目,索引)=>
//12/4=每行3列
卡片标题
一些在卡片标题上构建的快速示例文本
并且构成了卡片内容的大部分。
去某处
)
}

您可以使用引导网格执行类似操作

通过在每行中放置3列,引导网格将在第三列之后的每个新列中打断该列


{项目&&
items.map((项目,索引)=>
//12/4=每行3列
卡片标题
一些在卡片标题上构建的快速示例文本
并且构成了卡片内容的大部分。
去某处
)
}