refactor: reorganize all components (#8303)

This commit is contained in:
neverland
2021-03-08 11:50:37 +08:00
committed by GitHub
parent 3144a63d2b
commit e540876398
193 changed files with 1307 additions and 400 deletions
+46
View File
@@ -0,0 +1,46 @@
import { defineComponent } from 'vue';
import { createNamespace } from '../utils';
import { BORDER_TOP_BOTTOM } from '../utils/constant';
const [name, bem] = createNamespace('cell-group');
export default defineComponent({
name,
inheritAttrs: false,
props: {
title: String,
border: {
type: Boolean,
default: true,
},
},
setup(props, { slots, attrs }) {
const renderGroup = () => (
<div class={[bem(), { [BORDER_TOP_BOTTOM]: props.border }]} {...attrs}>
{slots.default?.()}
</div>
);
const renderTitle = () => (
<div class={bem('title')}>
{slots.title ? slots.title() : props.title}
</div>
);
return () => {
if (props.title || slots.title) {
return (
<>
{renderTitle()}
{renderGroup()}
</>
);
}
return renderGroup();
};
},
});