1
1
import { defineComponent , ComponentCustomOptions } from 'vue' ;
2
- import { obtainSlot , getSuperSlot } from './utils'
2
+ import { obtainSlot , getSuperSlot , getSlot } from './utils'
3
3
import { build as optionComputed } from './option/computed'
4
4
import { build as optionData } from './option/data'
5
5
import { build as optionMethodsAndLifecycle } from './option/methodsAndLifecycle'
@@ -103,22 +103,35 @@ function build(cons: Cons, option: ComponentOption) {
103
103
}
104
104
function _Component ( arg : ComponentConsOption , cb : ( cons : Cons , option : ComponentOption ) => any ) {
105
105
if ( typeof arg === 'function' ) {
106
+ console . log ( 'zxzxzx A' )
106
107
return cb ( arg , { } )
107
108
}
109
+ console . log ( 'zxzxzx B' )
108
110
return function ( cons : Cons ) {
111
+ console . log ( 'zxzxzx C' )
109
112
return cb ( cons , arg )
110
113
}
111
114
}
112
115
export function ComponentBase ( arg : ComponentConsOption ) : any {
113
116
return _Component ( arg , function ( cons : Cons , option : ComponentOption ) {
117
+ console . log ( 'zxzxzx D' )
114
118
build ( cons , option )
115
119
return cons
116
120
} )
117
121
}
118
122
119
123
export function Component ( arg : ComponentConsOption ) : any {
124
+ console . log ( 'zxzxzx' , arg )
120
125
return _Component ( arg , function ( cons : Cons , option : ComponentOption ) {
126
+ console . log ( 'zxzxzx 2' )
121
127
build ( cons , option )
128
+ // const slot = getSlot(cons.prototype)!
129
+ // Object.defineProperty(cons, '__vccOpts', {
130
+ // value: slot.cachedVueComponent
131
+ // })
132
+ // console.log('kkkk', '__vccOpts' in cons, cons)
133
+ // return cons
122
134
return obtainSlot ( cons . prototype ) . cachedVueComponent
123
135
} )
136
+
124
137
}
0 commit comments