mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-05 19:41:42 +08:00
40 lines
818 B
JavaScript
40 lines
818 B
JavaScript
import { createNamespace } from '../utils';
|
|
|
|
const [createComponent, bem] = createNamespace('row');
|
|
|
|
export default createComponent({
|
|
props: {
|
|
type: String,
|
|
align: String,
|
|
justify: String,
|
|
tag: {
|
|
type: String,
|
|
default: 'div'
|
|
},
|
|
gutter: {
|
|
type: [Number, String],
|
|
default: 0
|
|
}
|
|
},
|
|
|
|
render() {
|
|
const { align, justify } = this;
|
|
const flex = this.type === 'flex';
|
|
const margin = `-${Number(this.gutter) / 2}px`;
|
|
const style = this.gutter ? { marginLeft: margin, marginRight: margin } : {};
|
|
|
|
return (
|
|
<this.tag
|
|
style={style}
|
|
class={bem({
|
|
flex,
|
|
[`align-${align}`]: flex && align,
|
|
[`justify-${justify}`]: flex && justify
|
|
})}
|
|
>
|
|
{this.slots()}
|
|
</this.tag>
|
|
);
|
|
}
|
|
});
|