mirror of https://github.com/vuejs/core.git
refactor(runtime-core): replace vnode.shapeFlag checks with existed functions
This commit is contained in:
parent
a20a4cb36a
commit
a866b288b6
|
@ -3,6 +3,7 @@ import {
|
||||||
type Data,
|
type Data,
|
||||||
type FunctionalComponent,
|
type FunctionalComponent,
|
||||||
getComponentName,
|
getComponentName,
|
||||||
|
isStatefulComponent,
|
||||||
} from './component'
|
} from './component'
|
||||||
import {
|
import {
|
||||||
Comment,
|
Comment,
|
||||||
|
@ -63,6 +64,7 @@ export function renderComponentRoot(
|
||||||
inheritAttrs,
|
inheritAttrs,
|
||||||
} = instance
|
} = instance
|
||||||
const prev = setCurrentRenderingInstance(instance)
|
const prev = setCurrentRenderingInstance(instance)
|
||||||
|
const isStateful = isStatefulComponent(instance)
|
||||||
|
|
||||||
let result
|
let result
|
||||||
let fallthroughAttrs
|
let fallthroughAttrs
|
||||||
|
@ -71,7 +73,7 @@ export function renderComponentRoot(
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (vnode.shapeFlag & ShapeFlags.STATEFUL_COMPONENT) {
|
if (isStateful) {
|
||||||
// withProxy is a proxy with a different `has` trap only for
|
// withProxy is a proxy with a different `has` trap only for
|
||||||
// runtime-compiled render functions using `with` block.
|
// runtime-compiled render functions using `with` block.
|
||||||
const proxyToUse = withProxy || proxy
|
const proxyToUse = withProxy || proxy
|
||||||
|
@ -154,9 +156,8 @@ export function renderComponentRoot(
|
||||||
|
|
||||||
if (fallthroughAttrs && inheritAttrs !== false) {
|
if (fallthroughAttrs && inheritAttrs !== false) {
|
||||||
const keys = Object.keys(fallthroughAttrs)
|
const keys = Object.keys(fallthroughAttrs)
|
||||||
const { shapeFlag } = root
|
|
||||||
if (keys.length) {
|
if (keys.length) {
|
||||||
if (shapeFlag & (ShapeFlags.ELEMENT | ShapeFlags.COMPONENT)) {
|
if (isElementRoot(root)) {
|
||||||
if (propsOptions && keys.some(isModelListener)) {
|
if (propsOptions && keys.some(isModelListener)) {
|
||||||
// If a v-model listener (onUpdate:xxx) has a corresponding declared
|
// If a v-model listener (onUpdate:xxx) has a corresponding declared
|
||||||
// prop, it indicates this component expects to handle v-model and
|
// prop, it indicates this component expects to handle v-model and
|
||||||
|
@ -210,8 +211,8 @@ export function renderComponentRoot(
|
||||||
if (
|
if (
|
||||||
__COMPAT__ &&
|
__COMPAT__ &&
|
||||||
isCompatEnabled(DeprecationTypes.INSTANCE_ATTRS_CLASS_STYLE, instance) &&
|
isCompatEnabled(DeprecationTypes.INSTANCE_ATTRS_CLASS_STYLE, instance) &&
|
||||||
vnode.shapeFlag & ShapeFlags.STATEFUL_COMPONENT &&
|
isStateful &&
|
||||||
root.shapeFlag & (ShapeFlags.ELEMENT | ShapeFlags.COMPONENT)
|
isElementRoot(root)
|
||||||
) {
|
) {
|
||||||
const { class: cls, style } = vnode.props || {}
|
const { class: cls, style } = vnode.props || {}
|
||||||
if (cls || style) {
|
if (cls || style) {
|
||||||
|
|
Loading…
Reference in New Issue