mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[improvement] Col: jsx (#2500)
This commit is contained in:
parent
7a19675e1f
commit
9e01b1ef16
@ -1,19 +1,8 @@
|
||||
<template>
|
||||
<component
|
||||
:is="tag"
|
||||
:class="b({ [span]: span, [`offset-${offset}`]: offset })"
|
||||
:style="style"
|
||||
>
|
||||
<slot />
|
||||
</component>
|
||||
</template>
|
||||
import { use } from '../utils';
|
||||
|
||||
<script>
|
||||
import create from '../utils/create';
|
||||
|
||||
export default create({
|
||||
name: 'col',
|
||||
const [sfc, bem] = use('col');
|
||||
|
||||
export default sfc({
|
||||
props: {
|
||||
span: [Number, String],
|
||||
offset: [Number, String],
|
||||
@ -32,6 +21,14 @@ export default create({
|
||||
const padding = `${this.gutter / 2}px`;
|
||||
return this.gutter ? { paddingLeft: padding, paddingRight: padding } : {};
|
||||
}
|
||||
},
|
||||
|
||||
render(h) {
|
||||
const { span, offset } = this;
|
||||
return (
|
||||
<this.tag class={bem({ [span]: span, [`offset-${offset}`]: offset })} style={this.style}>
|
||||
{this.$slots.default}
|
||||
</this.tag>
|
||||
);
|
||||
}
|
||||
});
|
||||
</script>
|
Loading…
x
Reference in New Issue
Block a user