Skip to content

Commit 5418c88

Browse files
committed
wip(app-vapor): 同步编译器
1 parent eec48d2 commit 5418c88

File tree

3 files changed

+27
-12
lines changed

3 files changed

+27
-12
lines changed

packages/uni-cli-shared/lib/vapor/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45001,9 +45001,14 @@ class DomCodeGenerator {
4500145001
}
4500245002
genTextElementCode(params) {
4500345003
const { tag, attrs, children } = params;
45004-
const textContent = this.extractTextContent(children);
45005-
const finalAttrs = this.mergeTextAttributes(attrs, textContent);
45006-
return this.buildElementStatements(tag, finalAttrs, void 0);
45004+
const hasComplexChildren = children && children.some((child) => child.type === NODE_TYPE_ELEMENT);
45005+
if (hasComplexChildren) {
45006+
return this.buildElementStatements(tag, attrs, children);
45007+
} else {
45008+
const textContent = this.extractTextContent(children);
45009+
const finalAttrs = this.mergeTextAttributes(attrs, textContent);
45010+
return this.buildElementStatements(tag, finalAttrs, void 0);
45011+
}
4500745012
}
4500845013
genRegularElementCode(params) {
4500945014
const { tag, attrs, children } = params;
@@ -45045,7 +45050,7 @@ class DomCodeGenerator {
4504545050
}
4504645051
}
4504745052
}
45048-
if (children && children.length > 0 && tag !== NODE_TYPE_TEXT) {
45053+
if (children && children.length > 0) {
4504945054
for (const child of children) {
4505045055
const inlineCode = this.tryInlineChild(child);
4505145056
if (inlineCode) {

packages/uni-cli-shared/lib/vapor/@vue/compiler-vapor/dist/compiler-vapor.cjs.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1937,9 +1937,14 @@ class DomCodeGenerator {
19371937
}
19381938
genTextElementCode(params) {
19391939
const { tag, attrs, children } = params;
1940-
const textContent = this.extractTextContent(children);
1941-
const finalAttrs = this.mergeTextAttributes(attrs, textContent);
1942-
return this.buildElementStatements(tag, finalAttrs, void 0);
1940+
const hasComplexChildren = children && children.some((child) => child.type === NODE_TYPE_ELEMENT);
1941+
if (hasComplexChildren) {
1942+
return this.buildElementStatements(tag, attrs, children);
1943+
} else {
1944+
const textContent = this.extractTextContent(children);
1945+
const finalAttrs = this.mergeTextAttributes(attrs, textContent);
1946+
return this.buildElementStatements(tag, finalAttrs, void 0);
1947+
}
19431948
}
19441949
genRegularElementCode(params) {
19451950
const { tag, attrs, children } = params;
@@ -1981,7 +1986,7 @@ class DomCodeGenerator {
19811986
}
19821987
}
19831988
}
1984-
if (children && children.length > 0 && tag !== NODE_TYPE_TEXT) {
1989+
if (children && children.length > 0) {
19851990
for (const child of children) {
19861991
const inlineCode = this.tryInlineChild(child);
19871992
if (inlineCode) {

packages/uni-cli-shared/lib/vapor/@vue/compiler-vapor/dist/compiler-vapor.esm-browser.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34465,9 +34465,14 @@ class DomCodeGenerator {
3446534465
}
3446634466
genTextElementCode(params) {
3446734467
const { tag, attrs, children } = params;
34468-
const textContent = this.extractTextContent(children);
34469-
const finalAttrs = this.mergeTextAttributes(attrs, textContent);
34470-
return this.buildElementStatements(tag, finalAttrs, void 0);
34468+
const hasComplexChildren = children && children.some((child) => child.type === NODE_TYPE_ELEMENT);
34469+
if (hasComplexChildren) {
34470+
return this.buildElementStatements(tag, attrs, children);
34471+
} else {
34472+
const textContent = this.extractTextContent(children);
34473+
const finalAttrs = this.mergeTextAttributes(attrs, textContent);
34474+
return this.buildElementStatements(tag, finalAttrs, void 0);
34475+
}
3447134476
}
3447234477
genRegularElementCode(params) {
3447334478
const { tag, attrs, children } = params;
@@ -34509,7 +34514,7 @@ class DomCodeGenerator {
3450934514
}
3451034515
}
3451134516
}
34512-
if (children && children.length > 0 && tag !== NODE_TYPE_TEXT) {
34517+
if (children && children.length > 0) {
3451334518
for (const child of children) {
3451434519
const inlineCode = this.tryInlineChild(child);
3451534520
if (inlineCode) {

0 commit comments

Comments
 (0)