[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
+13 -15
View File
@@ -2,20 +2,18 @@ import { use, isDef } from '../utils';
const [sfc, bem] = use('info');
export default sfc({
functional: true,
function Info(h, props, slots, ctx) {
return (
isDef(props.info) && (
<div class={bem()} {...ctx.data}>
{props.info}
</div>
)
);
}
props: {
info: [String, Number]
},
Info.props = {
info: [String, Number]
};
render(h, { props, data }) {
return (
isDef(props.info) && (
<div class={bem()} {...data}>
{props.info}
</div>
)
);
}
});
export default sfc(Info);