From 067bd3387e96db3fbdd8c0b0fe93f2fec674f0f1 Mon Sep 17 00:00:00 2001 From: Blake Newman Date: Fri, 28 Apr 2017 11:40:58 +0100 Subject: [PATCH] [Fix] functional SFC style injection support --- lib/component-normalizer.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/component-normalizer.js b/lib/component-normalizer.js index 9a97239d..7d34f7e1 100644 --- a/lib/component-normalizer.js +++ b/lib/component-normalizer.js @@ -61,7 +61,16 @@ module.exports = function normalizeComponent ( hook = injectStyles } - if (hook) { + if (hook && options.functional && injectStyles) { + // inject styles for functioal component in vue file + const existing = options.render + options.render = function renderWithStyleInjection (...args) { + hook(args[1]) + return existing(...args) + } + } + + if (hook && !options.functional) { // inject component registration as beforeCreate hook var existing = options.beforeCreate options.beforeCreate = existing