鍍金池/ 問答/HTML/ 兩個數(shù)據(jù)源 在頁面上交叉顯示時,頁面不整齊

兩個數(shù)據(jù)源 在頁面上交叉顯示時,頁面不整齊

有兩個數(shù)據(jù)源 A , B.
在頁面上按一行四列(一條數(shù)據(jù)是一個Card, 一行四張Card) 如: A1, B1, A2, B2 這樣交叉顯示?
如下:dataSource={data}, data是A與B合在一起的數(shù)據(jù)源,item={A1, B1},
但是顯示有點(diǎn)問題,能提提供點(diǎn)建議嗎

<div style={{ padding: 5 }}>
    <Row gutter={10}>
        <Col span={20}>    
              <List
                 rowKey="id"
                 loading={loading}
                 grid={{ gutter: 10, column: 4}}
                 dataSource={data}
                 renderItem={item =>
                (
                    <div style={{display: 'inline'}}>
                        <List.Item>
                              <Card hoverable style={{ fontSize: 14, }} type={ 'inner' } title={"合約"}>
                                  <font style={{fontSize:"20", color:"#000", paddingLeft: 25}}>{[item[0].symbol,"(", item[0].cn_name,")"]}</font><br/>
                                  <font style={{fontSize:"20", color:"#000", paddingLeft: 25}}>{item[0].expiry}</font>
                            </Card>
                        </List.Item>,
                           <List.Item>
                            <Card hoverable style={{ fontSize: 14}} type={ 'inner' } title={"合約候選"} extra={<Switch defaultChecked onChange={this.onChange(item.symbol)}/>}>
                                  <font style={{fontSize:"20", color:"#000", paddingLeft: 25}}>{[item[1].symbol,"(", item[1].cn_name,")"]}</font><br/>
                                  <font style={{fontSize:"20", color:"#000", paddingLeft: 25}}>{item[1].expiry}</font>
                            </Card>
                        </List.Item>
                    </div>
                )
                }
            />
        </Col>
        
    </Row>        
</div>

頁面顯示如下, 后面的Card為何與前面的Card不對齊呢, 請各位給點(diǎn)修改建議:
圖片描述

回答
編輯回答
憶當(dāng)年

不知道你是用什么來渲染數(shù)據(jù)的,你可以先處理數(shù)據(jù),將A和B兩個數(shù)據(jù)整理成一個新的數(shù)據(jù)源,再進(jìn)行渲染。
你應(yīng)該用的是iView,樣式問題你用瀏覽器調(diào)試下吧,看結(jié)構(gòu)代碼看不出來什么問題。

2017年12月13日 17:54
編輯回答
不討喜

如下:dataSource={data}, data是A與B合在一起的數(shù)據(jù)源,item={A1, B1},
但是顯示有點(diǎn)問題,能提提供點(diǎn)建議嗎: 
去除<div>的塊狀顯示即可

<div style={{ padding: 5 }}>
    <Row gutter={10}>
        <Col span={20}>    
              <List
                 rowKey="id"
                 loading={loading}
                 grid={{ gutter: 10, column: 4}}
                 dataSource={data}
                 renderItem={item =>
                (
                    <div>
                        <List.Item>
                              <Card hoverable style={{ fontSize: 14, }} type={ 'inner' } title={"合約"}>
                                  <font style={{fontSize:"20", color:"#000", paddingLeft: 25}}>{[item[0].symbol,"(", item[0].cn_name,")"]}</font><br/>
                                  <font style={{fontSize:"20", color:"#000", paddingLeft: 25}}>{item[0].expiry}</font>
                            </Card>
                        </List.Item>,
                           <List.Item>
                            <Card hoverable style={{ fontSize: 14}} type={ 'inner' } title={"合約候選"} extra={<Switch defaultChecked onChange={this.onChange(item.symbol)}/>}>
                                  <font style={{fontSize:"20", color:"#000", paddingLeft: 25}}>{[item[1].symbol,"(", item[1].cn_name,")"]}</font><br/>
                                  <font style={{fontSize:"20", color:"#000", paddingLeft: 25}}>{item[1].expiry}</font>
                            </Card>
                        </List.Item>
                    </div>
                )
                }
            />
        </Col>
        
    </Row>        
</div>

頁面顯示如下:
圖片描述

2018年4月18日 21:02