mirror of https://github.com/vuejs/core.git
chore: improve
This commit is contained in:
parent
7c9bd7c093
commit
5392c7a956
|
@ -32,16 +32,11 @@ function hasMultipleChildren(node: ElementNode): boolean {
|
||||||
|
|
||||||
const first = children[0]
|
const first = children[0]
|
||||||
|
|
||||||
// template
|
|
||||||
if (first && isTemplateNode(first)) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// has v-for
|
// has v-for
|
||||||
if (
|
if (
|
||||||
children.length === 1 &&
|
children.length === 1 &&
|
||||||
first.type === NodeTypes.ELEMENT &&
|
first.type === NodeTypes.ELEMENT &&
|
||||||
findDir(first, 'for')
|
(findDir(first, 'for') || isTemplateNode(first))
|
||||||
) {
|
) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -51,10 +46,11 @@ function hasMultipleChildren(node: ElementNode): boolean {
|
||||||
|
|
||||||
// has v-if/v-else-if/v-else
|
// has v-if/v-else-if/v-else
|
||||||
if (
|
if (
|
||||||
children.length > 1 &&
|
|
||||||
children.every(
|
children.every(
|
||||||
(c, index) =>
|
(c, index) =>
|
||||||
c.type === NodeTypes.ELEMENT &&
|
c.type === NodeTypes.ELEMENT &&
|
||||||
|
// not template
|
||||||
|
!isTemplateNode(c) &&
|
||||||
// not has v-for
|
// not has v-for
|
||||||
!findDir(c, 'for') &&
|
!findDir(c, 'for') &&
|
||||||
// if the first child has v-if, the rest should also have v-else-if/v-else
|
// if the first child has v-if, the rest should also have v-else-if/v-else
|
||||||
|
|
Loading…
Reference in New Issue