Skip to content

Commit

Permalink
[Fix] functional SFC style injection support
Browse files Browse the repository at this point in the history
  • Loading branch information
blake-newman committed May 2, 2017
1 parent 8e34bad commit bea3e64
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/component-normalizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (h, context) {
hook(context)
return existing(h, context)
}
}

if (hook && !options.functional) {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
Expand Down

0 comments on commit bea3e64

Please sign in to comment.