mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
38 lines
704 B
TypeScript
38 lines
704 B
TypeScript
import { VantComponent } from '../common/component';
|
|
|
|
VantComponent({
|
|
relation: {
|
|
name: 'row',
|
|
type: 'ancestor'
|
|
},
|
|
|
|
props: {
|
|
span: Number,
|
|
offset: Number
|
|
},
|
|
|
|
data: {
|
|
style: ''
|
|
},
|
|
|
|
computed: {
|
|
classes(): string {
|
|
const { span, offset } = this.data;
|
|
return this.classNames('van-col', {
|
|
[`van-col--${span}`]: span,
|
|
[`van-col--offset-${offset}`]: offset
|
|
});
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
setGutter(gutter: number) {
|
|
const padding = `${gutter / 2}px`;
|
|
const style = gutter ? `padding-left: ${padding}; padding-right: ${padding};` : '';
|
|
if (style !== this.data.style) {
|
|
this.set({ style });
|
|
}
|
|
}
|
|
}
|
|
});
|