mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 02:48:55 +08:00
调整渲染方式
This commit is contained in:
parent
aa3cd30653
commit
f0328ea6ac
@ -103,27 +103,32 @@ export default class Grid<T> extends React.Component<GridProps & T, object> {
|
||||
fromBsClass((column as Column).columnClassName)
|
||||
)}
|
||||
>
|
||||
{Array.isArray(column)
|
||||
? this.renderColumns(column)
|
||||
: this.renderChild(`column/${key}`, column, key, length)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
renderColumns(columns: ColumnArray): React.ReactElement<any> | null {
|
||||
const {className, classnames: cx} = this.props;
|
||||
|
||||
return (
|
||||
<div className={cx('Grid', className)}>
|
||||
{columns.map((column, key) =>
|
||||
this.renderColumn(column, key, columns.length)
|
||||
{Array.isArray(column) ? (
|
||||
<div className={cx('Grid')}>
|
||||
{column.map((column, key) =>
|
||||
this.renderColumn(column, key, column.length)
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
this.renderChild(`column/${key}`, column, key, length)
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
renderColumns(columns: ColumnArray) {
|
||||
return columns.map((column, key) =>
|
||||
this.renderColumn(column, key, columns.length)
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
return this.renderColumns(this.props.columns);
|
||||
const {className, classnames: cx} = this.props;
|
||||
return (
|
||||
<div className={cx('Grid', className)}>
|
||||
{this.renderColumns(this.props.columns)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,17 +56,18 @@ export default class HBox extends React.Component<HBoxProps, object> {
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
const {className, columns, classPrefix: ns} = this.props;
|
||||
renderColumns() {
|
||||
const {columns} = this.props;
|
||||
|
||||
return (
|
||||
<div className={cx(`${ns}Hbox`, className)}>
|
||||
{columns.map((column, key) =>
|
||||
this.renderColumn(column, key, columns.length)
|
||||
)}
|
||||
</div>
|
||||
return columns.map((column, key) =>
|
||||
this.renderColumn(column, key, columns.length)
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
const {className, classnames: cx} = this.props;
|
||||
return <div className={cx(`Hbox`, className)}>{this.renderColumns()}</div>;
|
||||
}
|
||||
}
|
||||
|
||||
@Renderer({
|
||||
|
Loading…
Reference in New Issue
Block a user