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 11import isPlainObject from 'lodash/isPlainObject'
22
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+
38const camelizeRE = / - ( \w ) / g
49const camelize = ( str ) => {
510 return str . replace ( camelizeRE , ( _ , c ) => c ? c . toUpperCase ( ) : '' )
@@ -67,8 +72,11 @@ const getOptionProps = (instance) => {
6772 const props = ( Ctor . options || { } ) . props || { }
6873 const res = { }
6974 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
7280 }
7381 }
7482 return { ...res , ...propsData }
You can’t perform that action at this time.
0 commit comments