Skip to content

Commit bea3e64

Browse files
committed
[Fix] functional SFC style injection support
1 parent 8e34bad commit bea3e64

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/component-normalizer.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,16 @@ module.exports = function normalizeComponent (
6161
hook = injectStyles
6262
}
6363

64-
if (hook) {
64+
if (hook && options.functional && injectStyles) {
65+
// inject styles for functioal component in vue file
66+
const existing = options.render
67+
options.render = function renderWithStyleInjection (h, context) {
68+
hook(context)
69+
return existing(h, context)
70+
}
71+
}
72+
73+
if (hook && !options.functional) {
6574
// inject component registration as beforeCreate hook
6675
var existing = options.beforeCreate
6776
options.beforeCreate = existing

0 commit comments

Comments
 (0)