@@ -18,7 +18,7 @@ export type Cons = VueCons
1818
1919type SetupFunction < T > = ( this : void , props : Readonly < any > , ctx : SetupContext < any > ) => T | Promise < T >
2020export type OptionSetupFunction = SetupFunction < any >
21- export type ComponentSetupFunction = SetupFunction < Record < string , any > >
21+ export type ComponentSetupFunction = SetupFunction < Record < string , any > >
2222function ComponentOption ( cons : Cons , extend ?: any ) {
2323
2424 const optionBuilder : OptionBuilder = { }
@@ -74,7 +74,7 @@ function buildComponent(cons: Cons, arg: ComponentOption, extend?: any): any {
7474 const option = ComponentOption ( cons , extend )
7575 const slot = obtainSlot ( cons . prototype )
7676 Object . keys ( arg ) . reduce < Record < string , any > > ( ( option , name : string ) => {
77- if ( [ 'options' , 'modifier' , 'emits' , 'setup' ] . includes ( name ) ) {
77+ if ( [ 'options' , 'modifier' , 'emits' , 'setup' ] . includes ( name ) ) {
7878 return option
7979 }
8080 option [ name ] = arg [ name as keyof ComponentOption ]
@@ -91,17 +91,17 @@ function buildComponent(cons: Cons, arg: ComponentOption, extend?: any): any {
9191 } else {
9292 const oldSetup : OptionSetupFunction = option . setup
9393 const newSetup : ComponentSetupFunction = arg . setup
94-
95- const setup : ComponentSetupFunction = function ( props , ctx ) {
94+
95+ const setup : ComponentSetupFunction = function ( props , ctx ) {
9696 const newRet = newSetup ( props , ctx )
9797 const oldRet = oldSetup ( props , ctx )
98- if ( oldRet instanceof Promise || newRet instanceof Promise ) {
99- return Promise . all ( [ newRet , oldRet ] ) . then ( ( arr ) => {
100- return Object . assign ( { } , arr [ 0 ] , arr [ 1 ] )
98+ if ( oldRet instanceof Promise || newRet instanceof Promise ) {
99+ return Promise . all ( [ newRet , oldRet ] ) . then ( ( arr ) => {
100+ return Object . assign ( { } , arr [ 0 ] , arr [ 1 ] )
101101 } )
102- } else {
102+ } else {
103103
104- return Object . assign ( { } , newRet , oldRet )
104+ return Object . assign ( { } , newRet , oldRet )
105105 }
106106
107107 }
@@ -151,12 +151,6 @@ export function ComponentBase(arg: ComponentConsOption): any {
151151export function Component ( arg : ComponentConsOption ) : any {
152152 return _Component ( arg , function ( cons : Cons , option : ComponentOption ) {
153153 build ( cons , option )
154- // const slot = getSlot(cons.prototype)!
155- // Object.defineProperty(cons, '__vccOpts', {
156- // value: slot.cachedVueComponent
157- // })
158- // console.log('kkkk', '__vccOpts' in cons, cons)
159- // return cons
160154 return obtainSlot ( cons . prototype ) . cachedVueComponent
161155 } )
162156}
0 commit comments