refactor: immutable -> readonly
This commit is contained in:
@@ -4,10 +4,10 @@ export {
|
||||
toRefs,
|
||||
reactive,
|
||||
isReactive,
|
||||
immutable,
|
||||
isImmutable,
|
||||
readonly,
|
||||
isReadonly,
|
||||
toRaw,
|
||||
markImmutable,
|
||||
markReadonly,
|
||||
markNonReactive,
|
||||
effect,
|
||||
// types
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { VNode, normalizeVNode, VNodeChild } from './vnode'
|
||||
import { ReactiveEffect, UnwrapRef, reactive, immutable } from '@vue/reactivity'
|
||||
import { ReactiveEffect, UnwrapRef, reactive, readonly } from '@vue/reactivity'
|
||||
import { EMPTY_OBJ, isFunction, capitalize, invokeHandlers } from '@vue/shared'
|
||||
import { RenderProxyHandlers } from './componentProxy'
|
||||
import { ComponentPropsOptions, ExtractPropTypes } from './componentProps'
|
||||
@@ -233,7 +233,7 @@ export function setupStatefulComponent(instance: ComponentInstance) {
|
||||
// so props change can be tracked by watchers
|
||||
// it will be updated in resolveProps() on updates before render
|
||||
const propsProxy = (instance.propsProxy = setup.length
|
||||
? immutable(instance.props)
|
||||
? readonly(instance.props)
|
||||
: null)
|
||||
const setupContext = (instance.setupContext =
|
||||
setup.length > 1 ? createSetupContext(instance) : null)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { immutable, toRaw, lock, unlock } from '@vue/reactivity'
|
||||
import { readonly, toRaw, lock, unlock } from '@vue/reactivity'
|
||||
import {
|
||||
EMPTY_OBJ,
|
||||
camelize,
|
||||
@@ -114,7 +114,7 @@ export function resolveProps(
|
||||
props[key] = val
|
||||
}
|
||||
|
||||
// allow mutation of propsProxy (which is immutable by default)
|
||||
// allow mutation of propsProxy (which is readonly by default)
|
||||
unlock()
|
||||
|
||||
if (rawProps != null) {
|
||||
@@ -179,13 +179,13 @@ export function resolveProps(
|
||||
}
|
||||
}
|
||||
|
||||
// lock immutable
|
||||
// lock readonly
|
||||
lock()
|
||||
|
||||
instance.props = __DEV__ ? immutable(props) : props
|
||||
instance.props = __DEV__ ? readonly(props) : props
|
||||
instance.attrs = options
|
||||
? __DEV__
|
||||
? immutable(attrs)
|
||||
? readonly(attrs)
|
||||
: attrs
|
||||
: instance.props
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user