refactor(runtime-core): make setup attrs proxy dev only

This commit is contained in:
Evan You
2020-04-06 17:57:27 -04:00
parent ec4a4c1e06
commit c5f0f63b91
5 changed files with 30 additions and 8 deletions

View File

@@ -13,11 +13,13 @@ import {
PatchFlags,
makeMap,
isReservedProp,
EMPTY_ARR
EMPTY_ARR,
def
} from '@vue/shared'
import { warn } from './warning'
import { Data, ComponentInternalInstance } from './component'
import { isEmitListener } from './componentEmits'
import { InternalObjectSymbol } from './vnode'
export type ComponentPropsOptions<P = Data> =
| ComponentObjectPropsOptions<P>
@@ -102,6 +104,7 @@ export function initProps(
) {
const props: Data = {}
const attrs: Data = {}
def(attrs, InternalObjectSymbol, true)
setFullProps(instance, rawProps, props, attrs)
const options = instance.type.props
// validation
@@ -310,7 +313,7 @@ export function normalizePropsOptions(
}
}
const normalizedEntry: NormalizedPropsOptions = [normalized, needCastKeys]
Object.defineProperty(raw, '_n', { value: normalizedEntry })
def(raw, '_n', normalizedEntry)
return normalizedEntry
}