From f0686a505ab661de1454b6c4ed29b31f2bb20d46 Mon Sep 17 00:00:00 2001 From: Clark Du Date: Fri, 12 Jan 2018 12:11:57 +0800 Subject: [PATCH] fix: no _ssr* in ssr functional tempalte --- src/core/vdom/create-functional-component.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/core/vdom/create-functional-component.js b/src/core/vdom/create-functional-component.js index d0cbd0a2584..359ed958470 100644 --- a/src/core/vdom/create-functional-component.js +++ b/src/core/vdom/create-functional-component.js @@ -15,6 +15,18 @@ import { validateProp } from '../util/index' +function fillSSRHelpers (Context, Ctor) { + const proto = Context.prototype + const ctorProto = Ctor.prototype + if (ctorProto._ssrNode && !proto._ssrNode) { + for (const key in ctorProto) { + if (key.indexOf('_ssr') === 0) { + proto[key] = ctorProto[key] + } + } + } +} + function FunctionalRenderContext ( data, props, @@ -22,6 +34,7 @@ function FunctionalRenderContext ( parent, Ctor ) { + fillSSRHelpers(Ctor, FunctionalRenderContext) const options = Ctor.options this.data = data this.props = props