@@ -41,7 +41,11 @@ function use(vm: VueInstance, _This: any) {
41
41
use = vm [ SETUP_USE ] ;
42
42
} else {
43
43
use = new Map ( ) ;
44
- vm [ SETUP_USE ] = use ;
44
+ Object . defineProperty ( vm , SETUP_USE , {
45
+ get ( ) {
46
+ return use ;
47
+ } ,
48
+ } ) ;
45
49
}
46
50
let app = use . get ( _This ) ! ;
47
51
if ( app ) {
@@ -54,13 +58,20 @@ function use(vm: VueInstance, _This: any) {
54
58
}
55
59
56
60
function proxyVue3Props ( app : InstanceType < DefineConstructor > , vm : VueInstance ) {
57
- const render = vm . $options ?. render as Function | undefined ;
61
+ interface Item {
62
+ ssrRender ?: Function ;
63
+ render ?: Function ;
64
+ }
65
+ if ( ! vm . $ ) {
66
+ return ;
67
+ }
68
+ const item = vm . $ as Item ;
69
+ const render = item . ssrRender || item . render ;
58
70
if ( app [ SETUP_SETUP_DEFINE ] && render ) {
59
71
const keys = Object . keys ( app . $defaultProps ) ;
60
72
if ( ! keys . length ) return ;
61
73
const proxyRender = ( ...args : any [ ] ) => {
62
74
const props = vm . $props ;
63
- const defaultProps = app . $defaultProps ;
64
75
const arr : { key : string ; pd : PropertyDescriptor } [ ] = [ ] ;
65
76
const dpp = createDefineProperty ( props ) ;
66
77
// Set default Props
@@ -83,10 +94,11 @@ function proxyVue3Props(app: InstanceType<DefineConstructor>, vm: VueInstance) {
83
94
// Resume default props
84
95
return res ;
85
96
} ;
86
- vm . $options . render = proxyRender ;
87
97
88
- if ( vm . $ ) {
89
- ( vm as any ) . $ . render = proxyRender ;
98
+ if ( item . ssrRender ) {
99
+ item . ssrRender = proxyRender ;
100
+ } else if ( item . render ) {
101
+ item . render = proxyRender ;
90
102
}
91
103
}
92
104
}
0 commit comments