diff --git a/src/image/image.tsx b/src/image/image.tsx index 09b846b8..f0c599ca 100644 --- a/src/image/image.tsx +++ b/src/image/image.tsx @@ -20,6 +20,10 @@ export default class Image extends Component { :host { display: inline-flex; } + .t-image__wrapper { + width: 100%; + height: 100%; + } `, ]; diff --git a/src/space/space.tsx b/src/space/space.tsx index 0ff4c4a6..73b231d6 100644 --- a/src/space/space.tsx +++ b/src/space/space.tsx @@ -61,9 +61,14 @@ export default class Space extends Component { this.renderGap = `${this.props.size}px`; } + // 由于space-item继承space的width:100%,space竖向布局时无法使space-item里面的内容水平居中。因此这种情况下需要textAlign:center + const centerVerticalStyle = + this.props.direction === 'vertical' && this.props.align === 'center' ? { textAlign: 'center' } : {}; + this.renderStyle = { gap: this.renderGap, ...(this.props.breakLine ? { flexWrap: 'wrap' } : {}), + ...centerVerticalStyle, ...this.props.innerStyle, }; }