refactor: use const enums for flags

This commit is contained in:
Evan You
2019-08-22 11:12:37 -04:00
parent f26cd5dfe4
commit f3e9848bb2
11 changed files with 144 additions and 130 deletions

View File

@@ -12,7 +12,7 @@ import {
} from '@vue/shared'
import { warn } from './warning'
import { Data, ComponentInstance } from './component'
import { FULL_PROPS } from './patchFlags'
import { PatchFlags } from './patchFlags'
export type ComponentPropsOptions<P = Data> = {
[K in keyof P]: Prop<P[K]> | null
@@ -167,7 +167,10 @@ export function resolveProps(
// in case of dynamic props, check if we need to delete keys from
// the props proxy
const { patchFlag } = instance.vnode
if (propsProxy !== null && (patchFlag === 0 || patchFlag & FULL_PROPS)) {
if (
propsProxy !== null &&
(patchFlag === 0 || patchFlag & PatchFlags.FULL_PROPS)
) {
const rawInitialProps = toRaw(propsProxy)
for (const key in rawInitialProps) {
if (!props.hasOwnProperty(key)) {