]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
feat(runtime-core): pass current props to prop default value functions
authorEvan You <yyx990803@gmail.com>
Tue, 18 Aug 2020 14:52:50 +0000 (10:52 -0400)
committerEvan You <yyx990803@gmail.com>
Tue, 18 Aug 2020 14:52:50 +0000 (10:52 -0400)
close #1886

packages/runtime-core/src/componentProps.ts

index 96b365b50ec7bfc531a003347f14c7d1f3ad8e60..fcf707e021ce4d77e9affc3326526aec6f763ae2 100644 (file)
@@ -291,7 +291,7 @@ function resolvePropValue(
       const defaultValue = opt.default
       value =
         opt.type !== Function && isFunction(defaultValue)
-          ? defaultValue()
+          ? defaultValue(props)
           : defaultValue
     }
     // boolean casting