[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

@@ -36,7 +36,6 @@ const mapInheritKey = { nativeOn: 'on' };
function functional(sfc) {
const { render } = sfc;
sfc.functional = true;
sfc.render = (h, context) => {
const inherit = inheritKey.reduce((obj, key) => {
if (context.data[key]) {
@@ -48,7 +47,7 @@ function functional(sfc) {
};
}
export default name => (sfc, isFunctional) => {
export default name => sfc => {
sfc.name = name;
sfc.install = install;
sfc.mixins = sfc.mixins || [];
@@ -58,7 +57,7 @@ export default name => (sfc, isFunctional) => {
defaultProps(sfc.props);
}
if (isFunctional) {
if (sfc.functional) {
functional(sfc);
}