File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 1
1
import isPlainObject from 'lodash/isPlainObject'
2
2
3
+ function getType ( fn ) {
4
+ const match = fn && fn . toString ( ) . match ( / ^ \s * f u n c t i o n ( \w + ) / )
5
+ return match ? match [ 1 ] : ''
6
+ }
7
+
3
8
const camelizeRE = / - ( \w ) / g
4
9
const camelize = ( str ) => {
5
10
return str . replace ( camelizeRE , ( _ , c ) => c ? c . toUpperCase ( ) : '' )
@@ -67,8 +72,11 @@ const getOptionProps = (instance) => {
67
72
const props = ( Ctor . options || { } ) . props || { }
68
73
const res = { }
69
74
for ( const [ k , v ] of Object . entries ( props ) ) {
70
- if ( v . default !== undefined ) {
71
- res [ k ] = typeof v . default === 'function' ? v . default ( ) : v . default
75
+ const def = v . default
76
+ if ( def !== undefined ) {
77
+ res [ k ] = typeof def === 'function' && getType ( v . type ) !== 'Function'
78
+ ? def . call ( instance )
79
+ : def
72
80
}
73
81
}
74
82
return { ...res , ...propsData }
You can’t perform that action at this time.
0 commit comments