[improvement] rename packages dir to src (#3659)
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
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(h) {
|
||||
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>
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,41 @@
|
||||
@import '../style/var';
|
||||
|
||||
.van-row {
|
||||
&::after {
|
||||
display: table;
|
||||
clear: both;
|
||||
content: "";
|
||||
}
|
||||
|
||||
&--flex {
|
||||
display: flex;
|
||||
|
||||
&::after {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
&--justify-center {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
&--justify-end {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
&--justify-space-between {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
&--justify-space-around {
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
&--align-center {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
&--align-bottom {
|
||||
align-items: flex-end;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user