From a878a7059d8055b78055d0e3f901cc00598f4b6e Mon Sep 17 00:00:00 2001 From: zrh122 <1229550935@qq.com> Date: Fri, 21 Jun 2019 11:28:17 +0800 Subject: [PATCH] fix: fix getting shadow root when component is functional --- lib/runtime/componentNormalizer.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/runtime/componentNormalizer.js b/lib/runtime/componentNormalizer.js index 6e2e9e764..6ece8a8e5 100644 --- a/lib/runtime/componentNormalizer.js +++ b/lib/runtime/componentNormalizer.js @@ -62,7 +62,12 @@ export default function normalizeComponent ( options._ssrRegister = hook } else if (injectStyles) { hook = shadowMode - ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) } + ? function () { + injectStyles.call( + this, + (options.functional ? this.parent : this).$root.$options.shadowRoot + ) + } : injectStyles }