我遇到此問題,如果將不同的列布局應用於React中的不同行,它會混淆其他行的列布局。例如,SpecialRows
是我想要顯示的表中的行。 SpecialBar
是存在於包含過濾,搜索等其他內容的表格上方的一個條。 SpecialBar
與SpecialRow
有不同的列布局,但是當我這樣做時,SpecialRow
的列現在模仿SpecialBar
的列,並將所有數據壓扁到右側。Reactjs - 表格行上的不同列布局會影響其他表格行
任何想法可能發生什麼?
class Table1 extends React.Component {
<Table>
<tbody>
<SpecialBar {...this.props}/>
{this.props.moreRows.map((row) =>
<SpecialRow {...this.props} />
)}
</tbody>
</Table>
}
class SpecialBar extends React.Component {
render() {
return (
<tr>
<td className='col-md-1'>Text A</td>
<td className='col-md-10>Text B</td>
<td className='col-md-1>Text C</td>
</tr>
);
}
}
class SpecialRow extends React.Component {
render() {
return (
<td className='col-md-2'>Stuff</td>
<td className='col-md-2'>Stuff</td>
<td className='col-md-2'>Stuff</td>
<td className='col-md-2'>Stuff</td>
<td className='col-md-1'>Stuff</td>
<td className='col-md-1'>Stuff</td>
<td className='col-md-1'>Stuff</td>
<td className='col-md-1'>Stuff</td>
);
}
}
你能爲此做一個小提琴,以便我們看到發生了什麼? – codeslayer1