@@ -12,7 +12,7 @@ import {
1212} from '../shared/util'
1313import { currentInstance , setCurrentInstance } from './currentInstance'
1414import { shallowReactive } from './reactivity/reactive'
15- import { isRef } from './reactivity/ref'
15+ import { proxyWithRefUnwrap } from './reactivity/ref'
1616
1717/**
1818 * @internal
@@ -68,7 +68,9 @@ export function initSetup(vm: Component) {
6868 // exposed for compiled render fn
6969 const proxy = ( vm . _setupProxy = { } )
7070 for ( const key in setupResult ) {
71- proxyWithRefUnwrap ( proxy , setupResult , key )
71+ if ( key !== '__sfc' ) {
72+ proxyWithRefUnwrap ( proxy , setupResult , key )
73+ }
7274 }
7375 }
7476 } else if ( __DEV__ && setupResult !== undefined ) {
@@ -81,25 +83,6 @@ export function initSetup(vm: Component) {
8183 }
8284}
8385
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-
10386function createSetupContext ( vm : Component ) : SetupContext {
10487 let exposeCalled = false
10588 return {
0 commit comments