zhangenming
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
3 additions and
6 deletions
-
packages/reactivity/src/computed.ts
|
|
@ -78,7 +78,8 @@ export function computed<T>( |
|
|
|
let getter: ComputedGetter<T> |
|
|
|
let setter: ComputedSetter<T> |
|
|
|
|
|
|
|
if (isFunction(getterOrOptions)) { |
|
|
|
const onlyGetter = isFunction(getterOrOptions) |
|
|
|
if (onlyGetter) { |
|
|
|
getter = getterOrOptions |
|
|
|
setter = __DEV__ |
|
|
|
? () => { |
|
|
@ -90,11 +91,7 @@ export function computed<T>( |
|
|
|
setter = getterOrOptions.set |
|
|
|
} |
|
|
|
|
|
|
|
const cRef = new ComputedRefImpl( |
|
|
|
getter, |
|
|
|
setter, |
|
|
|
isFunction(getterOrOptions) || !getterOrOptions.set |
|
|
|
) |
|
|
|
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter) |
|
|
|
|
|
|
|
if (__DEV__ && debugOptions) { |
|
|
|
cRef.effect.onTrack = debugOptions.onTrack |
|
|
|