mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 10:44:59 +00:00
[improvement] declare functional sfc (#2695)
This commit is contained in:
@@ -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>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user