Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(shared): 修复嵌套到第15层碰到 Text 导致子文本节点丢失,fix #6054 #8276

Merged
merged 2 commits into from
Dec 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions packages/shared/src/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,12 @@ export class BaseTemplate {
protected buildContainerTemplate (level: number, restart = false) {
let tmpl = ''
if (restart) {
if (!this.isSupportRecursive && this.supportXS) {
tmpl = '<comp i="{{i}}" l="{{l}}" />'
} else {
tmpl = '<comp i="{{i}}" />'
}
tmpl = `<block ${this.Adapter.if}="{{i.nn === '#text'}}">
<template is="tmpl_0_#text" data="{{i:i}}" />
</block>
<block ${this.Adapter.else}>
${!this.isSupportRecursive && this.supportXS ? '<comp i="{{i}}" l="{{l}}" />' : '<comp i="{{i}}" />'}
</block>`
} else {
const xs = !this.isSupportRecursive
? `xs.a(${level}, i.${Shortcuts.NodeName}, l)`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_19_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down Expand Up @@ -1273,7 +1278,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down Expand Up @@ -2037,7 +2047,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down Expand Up @@ -1215,7 +1220,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" />
<block jd:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block jd:else>
<comp i=\\"{{i}}\\" />
</block>
</template>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down Expand Up @@ -2732,7 +2737,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down Expand Up @@ -4972,7 +4982,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_9_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down Expand Up @@ -1707,7 +1712,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block qq:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block qq:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down Expand Up @@ -1194,7 +1199,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down Expand Up @@ -1959,7 +1969,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down Expand Up @@ -2724,7 +2739,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,12 @@ require(\\"./taro\\");
</template>

<template name=\\"tmpl_15_container\\">
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
<block wx:if=\\"{{i.nn === '#text'}}\\">
<template is=\\"tmpl_0_#text\\" data=\\"{{i:i}}\\" />
</block>
<block wx:else>
<comp i=\\"{{i}}\\" l=\\"{{l}}\\" />
</block>
</template>


Expand Down