[improvement] declare functional sfc (#2695)

This commit is contained in:
neverland
2019-02-06 21:11:12 +08:00
committed by GitHub
parent 061382014d
commit 1b60e4df80
14 changed files with 465 additions and 494 deletions

View File

@@ -5,34 +5,27 @@ import SwitchMixin from '../mixins/switch';
const [sfc, bem] = use('switch-cell');
export default sfc(
{
mixins: [SwitchMixin],
export default sfc({
functional: true,
props: {
title: String,
border: Boolean,
size: {
type: String,
default: '24px'
}
},
mixins: [SwitchMixin],
render(h, context, inherit) {
const { props } = context;
return (
<Cell
center
title={props.title}
border={props.border}
class={bem()}
{...inherit}
>
<Switch {...{ props, on: context.listeners }} />
</Cell>
);
props: {
title: String,
border: Boolean,
size: {
type: String,
default: '24px'
}
},
true
);
render(h, context, inherit) {
const { props } = context;
return (
<Cell center title={props.title} border={props.border} class={bem()} {...inherit}>
<Switch {...{ props, on: context.listeners }} />
</Cell>
);
}
});