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

@@ -1,7 +1,7 @@
import { ComponentInstance } from './component'
import { VNode, NormalizedChildren, normalizeVNode, VNodeChild } from './vnode'
import { isArray, isFunction } from '@vue/shared'
import { SLOTS_CHILDREN } from './typeFlags'
import { ShapeFlags } from './shapeFlags'
export type Slot = (...args: any[]) => VNode[]
export type Slots = Readonly<{
@@ -24,7 +24,7 @@ export function resolveSlots(
children: NormalizedChildren
) {
let slots: Slots | void
if (instance.vnode.shapeFlag & SLOTS_CHILDREN) {
if (instance.vnode.shapeFlag & ShapeFlags.SLOTS_CHILDREN) {
if ((children as any)._normalized) {
// pre-normalized slots object generated by compiler
slots = children as Slots