File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ import { VueConstructor } from 'vue'
99 */
1010function mergeData ( from : AnyObject , to : AnyObject ) : Object {
1111 if ( ! from ) return to
12+ if ( ! to ) return from
13+
1214 let key : any
1315 let toVal : any
1416 let fromVal : any
@@ -56,8 +58,8 @@ export function install(
5658 ) {
5759 return function mergedSetupFn ( props : any , context : any ) {
5860 return mergeData (
59- typeof parent === 'function' ? parent ( props , context ) || { } : { } ,
60- typeof child === 'function' ? child ( props , context ) || { } : { }
61+ typeof parent === 'function' ? parent ( props , context ) || { } : undefined ,
62+ typeof child === 'function' ? child ( props , context ) || { } : undefined
6163 )
6264 }
6365 }
Original file line number Diff line number Diff line change @@ -719,4 +719,16 @@ describe('setup', () => {
719719 expect ( context ) . toBe ( vm )
720720 } )
721721 } )
722+
723+ it ( 'should work after extending with an undefined setup' , ( ) => {
724+ const opts = {
725+ setup ( ) {
726+ return ( ) => h ( 'div' , 'Composition-api' )
727+ } ,
728+ }
729+ const Constructor = Vue . extend ( opts ) . extend ( { } )
730+
731+ const vm = new Vue ( Constructor ) . $mount ( )
732+ expect ( vm . $el . textContent ) . toBe ( 'Composition-api' )
733+ } )
722734} )
You can’t perform that action at this time.
0 commit comments