fix(core): generate fragment root with patchFlag + optimize fragment w/ patchFlag
This commit is contained in:
@@ -18,7 +18,13 @@ import {
|
||||
CacheExpression,
|
||||
createCacheExpression
|
||||
} from './ast'
|
||||
import { isString, isArray, NOOP } from '@vue/shared'
|
||||
import {
|
||||
isString,
|
||||
isArray,
|
||||
NOOP,
|
||||
PatchFlags,
|
||||
PatchFlagNames
|
||||
} from '@vue/shared'
|
||||
import { defaultOnError } from './errors'
|
||||
import {
|
||||
TO_STRING,
|
||||
@@ -283,7 +289,10 @@ function finalizeRoot(root: RootNode, context: TransformContext) {
|
||||
createCallExpression(helper(CREATE_BLOCK), [
|
||||
helper(FRAGMENT),
|
||||
`null`,
|
||||
root.children
|
||||
root.children,
|
||||
`${PatchFlags.UNKEYED_FRAGMENT} /* ${
|
||||
PatchFlagNames[PatchFlags.UNKEYED_FRAGMENT]
|
||||
} */`
|
||||
]),
|
||||
context
|
||||
)
|
||||
|
||||
@@ -79,7 +79,7 @@ export const transformFor = createStructuralDirectiveTransform(
|
||||
helper(FRAGMENT),
|
||||
`null`,
|
||||
renderExp,
|
||||
fragmentFlag + (__DEV__ ? ` /* ${PatchFlagNames[fragmentFlag]} */` : ``)
|
||||
`${fragmentFlag} /* ${PatchFlagNames[fragmentFlag]} */`
|
||||
])
|
||||
]) as ForCodegenNode
|
||||
|
||||
|
||||
Reference in New Issue
Block a user