File tree 2 files changed +6
-8
lines changed
2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change 1
1
import { effect , ReactiveEffect , activeReactiveEffectStack } from './effect'
2
- import { Ref , refSymbol , UnwrapRef } from './ref'
2
+ import { Ref , UnwrapRef } from './ref'
3
3
import { isFunction , NOOP } from '@vue/shared'
4
4
5
5
export interface ComputedRef < T > extends WritableComputedRef < T > {
@@ -46,7 +46,7 @@ export function computed<T>(
46
46
}
47
47
} )
48
48
return {
49
- [ refSymbol ] : true ,
49
+ _isRef : true ,
50
50
// expose effect so computed can be stopped
51
51
effect : runner ,
52
52
get value ( ) {
Original file line number Diff line number Diff line change @@ -4,10 +4,8 @@ import { isObject } from '@vue/shared'
4
4
import { reactive } from './reactive'
5
5
import { ComputedRef } from './computed'
6
6
7
- export const refSymbol = Symbol ( __DEV__ ? 'refSymbol' : '' )
8
-
9
7
export interface Ref < T = any > {
10
- [ refSymbol ] : true
8
+ _isRef : true
11
9
value : UnwrapRef < T >
12
10
}
13
11
@@ -21,7 +19,7 @@ export function ref(raw: any) {
21
19
}
22
20
raw = convert ( raw )
23
21
const v = {
24
- [ refSymbol ] : true ,
22
+ _isRef : true ,
25
23
get value ( ) {
26
24
track ( v , OperationTypes . GET , '' )
27
25
return raw
@@ -35,7 +33,7 @@ export function ref(raw: any) {
35
33
}
36
34
37
35
export function isRef ( v : any ) : v is Ref {
38
- return v ? v [ refSymbol ] === true : false
36
+ return v ? v . _isRef === true : false
39
37
}
40
38
41
39
export function toRefs < T extends object > (
@@ -53,7 +51,7 @@ function toProxyRef<T extends object, K extends keyof T>(
53
51
key : K
54
52
) : Ref < T [ K ] > {
55
53
return {
56
- [ refSymbol ] : true ,
54
+ _isRef : true ,
57
55
get value ( ) : any {
58
56
return object [ key ]
59
57
} ,
You can’t perform that action at this time.
0 commit comments