Skip to content

Commit 5874eb5

Browse files
edwardnycneiyichao03
and
neiyichao03
authored
feat: Unified as the key of raw in vue3 (#922)
Co-authored-by: neiyichao03 <[email protected]>
1 parent 000ffe4 commit 5874eb5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/reactivity/reactive.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ import { isRef, UnwrapRef } from './ref'
1616
import { rawSet, accessModifiedSet } from '../utils/sets'
1717
import { isForceTrigger } from './force'
1818

19+
const SKIPFLAG = '__v_skip'
20+
1921
export function isRaw(obj: any): boolean {
2022
return Boolean(
2123
obj &&
2224
hasOwn(obj, '__ob__') &&
2325
typeof obj.__ob__ === 'object' &&
24-
obj.__ob__?.__raw__
26+
obj.__ob__?.[SKIPFLAG]
2527
)
2628
}
2729

@@ -30,7 +32,7 @@ export function isReactive(obj: any): boolean {
3032
obj &&
3133
hasOwn(obj, '__ob__') &&
3234
typeof obj.__ob__ === 'object' &&
33-
!obj.__ob__?.__raw__
35+
!obj.__ob__?.[SKIPFLAG]
3436
)
3537
}
3638

@@ -261,7 +263,7 @@ export function markRaw<T extends object>(obj: T): T {
261263

262264
// set the vue observable flag at obj
263265
const ob = createObserver()
264-
ob.__raw__ = true
266+
ob[SKIPFLAG] = true
265267
def(obj, '__ob__', ob)
266268

267269
// mark as Raw

0 commit comments

Comments
 (0)