@@ -12,7 +12,7 @@ import {
12
12
} from '../shared/util'
13
13
import { currentInstance , setCurrentInstance } from './currentInstance'
14
14
import { shallowReactive } from './reactivity/reactive'
15
- import { isRef } from './reactivity/ref'
15
+ import { proxyWithRefUnwrap } from './reactivity/ref'
16
16
17
17
/**
18
18
* @internal
@@ -68,7 +68,9 @@ export function initSetup(vm: Component) {
68
68
// exposed for compiled render fn
69
69
const proxy = ( vm . _setupProxy = { } )
70
70
for ( const key in setupResult ) {
71
- proxyWithRefUnwrap ( proxy , setupResult , key )
71
+ if ( key !== '__sfc' ) {
72
+ proxyWithRefUnwrap ( proxy , setupResult , key )
73
+ }
72
74
}
73
75
}
74
76
} else if ( __DEV__ && setupResult !== undefined ) {
@@ -81,25 +83,6 @@ export function initSetup(vm: Component) {
81
83
}
82
84
}
83
85
84
- export function proxyWithRefUnwrap (
85
- target : any ,
86
- source : Record < string , any > ,
87
- key : string
88
- ) {
89
- Object . defineProperty ( target , key , {
90
- enumerable : true ,
91
- configurable : true ,
92
- get : ( ) => {
93
- const raw = source [ key ]
94
- return isRef ( raw ) ? raw . value : raw
95
- } ,
96
- set : newVal => {
97
- const raw = source [ key ]
98
- isRef ( raw ) ? ( raw . value = newVal ) : ( source [ key ] = newVal )
99
- }
100
- } )
101
- }
102
-
103
86
function createSetupContext ( vm : Component ) : SetupContext {
104
87
let exposeCalled = false
105
88
return {
0 commit comments