[improvement] Functional components be just functions (#2735)

This commit is contained in:
neverland
2019-02-14 11:56:02 +08:00
committed by GitHub
parent 166397dad4
commit 5a9143c736
21 changed files with 704 additions and 674 deletions

View File

@@ -2,21 +2,22 @@ import { use } from '../utils';
const [sfc, bem] = use('cell-group');
export default sfc({
functional: true,
function CellGroup(h, props, slots, ctx) {
return (
<div
class={[bem(), { 'van-hairline--top-bottom': props.border }]}
{...ctx.data}
>
{slots.default && slots.default()}
</div>
);
}
props: {
border: {
type: Boolean,
default: true
}
},
render(h, context) {
return (
<div class={[bem(), { 'van-hairline--top-bottom': context.props.border }]} {...context.data}>
{context.children}
</div>
);
CellGroup.props = {
border: {
type: Boolean,
default: true
}
});
};
export default sfc(CellGroup);