]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(compiler): only generate non-static ref for script setup if the binding exists
authorEvan You <yyx990803@gmail.com>
Wed, 1 Sep 2021 21:27:03 +0000 (17:27 -0400)
committerEvan You <yyx990803@gmail.com>
Wed, 1 Sep 2021 21:27:03 +0000 (17:27 -0400)
fix #4431

packages/compiler-core/src/transforms/transformElement.ts

index 4b142564f0aa161d33d1fc592031ebdeb17695d5..e31a2ccbf0a7cdfb7684b4732965c32991ae6d08 100644 (file)
@@ -465,7 +465,12 @@ export function buildProps(
         // in inline mode there is no setupState object, so we can't use string
         // keys to set the ref. Instead, we need to transform it to pass the
         // acrtual ref instead.
-        if (!__BROWSER__ && context.inline) {
+        if (
+          !__BROWSER__ &&
+          value &&
+          context.inline &&
+          context.bindingMetadata[value.content]
+        ) {
           isStatic = false
         }
       }