mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat: CellGroup component
This commit is contained in:
parent
2f1f540d6a
commit
bd5651402a
38
src-next/cell-group/index.js
Normal file
38
src-next/cell-group/index.js
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
// Utils
|
||||||
|
import { createNamespace } from '../utils';
|
||||||
|
import { BORDER_TOP_BOTTOM } from '../utils/constant';
|
||||||
|
|
||||||
|
const [createComponent, bem] = createNamespace('cell-group');
|
||||||
|
|
||||||
|
export default createComponent({
|
||||||
|
props: {
|
||||||
|
title: String,
|
||||||
|
border: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
setup(props, { slots }) {
|
||||||
|
return function () {
|
||||||
|
const Group = (
|
||||||
|
<div class={[bem(), { [BORDER_TOP_BOTTOM]: props.border }]}>
|
||||||
|
{slots.default?.()}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
if (props.title || slots.title) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div class={bem('title')} {...this.$attrs}>
|
||||||
|
{slots.title ? slots.title() : props.title}
|
||||||
|
</div>
|
||||||
|
{Group}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Group;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
12
src-next/cell-group/index.less
Normal file
12
src-next/cell-group/index.less
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
@import '../style/var';
|
||||||
|
|
||||||
|
.van-cell-group {
|
||||||
|
background-color: @cell-group-background-color;
|
||||||
|
|
||||||
|
&__title {
|
||||||
|
padding: @cell-group-title-padding;
|
||||||
|
color: @cell-group-title-color;
|
||||||
|
font-size: @cell-group-title-font-size;
|
||||||
|
line-height: @cell-group-title-line-height;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user