fix: root

This commit is contained in:
三咲智子 Kevin Deng 2023-11-26 03:24:12 +08:00
parent 9602cd2011
commit f1e5bee7d5
No known key found for this signature in database
GPG Key ID: 69992F2250DFD93E
3 changed files with 13 additions and 11 deletions

View File

@ -13,7 +13,7 @@ export function render() {
1: [n3], 1: [n3],
}, },
], ],
} = children(root); } = children(n0);
const n2 = createTextNode(count.value); const n2 = createTextNode(count.value);
insert(n2, n1, n3); insert(n2, n1, n3);
watchEffect(() => { watchEffect(() => {
@ -32,7 +32,7 @@ export function render() {
const n0 = t0(); const n0 = t0();
const { const {
0: [n1], 0: [n1],
} = children(root); } = children(n0);
watchEffect(() => { watchEffect(() => {
setAttr(n1, 'id', undefined, id.value); setAttr(n1, 'id', undefined, id.value);
}); });
@ -49,7 +49,7 @@ export function render() {
const n0 = t0(); const n0 = t0();
const { const {
0: [n1], 0: [n1],
} = children(root); } = children(n0);
watchEffect(() => { watchEffect(() => {
setHtml(n1, undefined, ''); setHtml(n1, undefined, '');
}); });
@ -66,7 +66,7 @@ export function render() {
const n0 = t0(); const n0 = t0();
const { const {
0: [n1], 0: [n1],
} = children(root); } = children(n0);
watchEffect(() => { watchEffect(() => {
setHtml(n1, undefined, code.value); setHtml(n1, undefined, code.value);
}); });
@ -83,7 +83,7 @@ export function render() {
const n0 = t0(); const n0 = t0();
const { const {
0: [n1], 0: [n1],
} = children(root); } = children(n0);
watchEffect(() => { watchEffect(() => {
on(n1, 'click', handleClick); on(n1, 'click', handleClick);
}); });
@ -100,7 +100,7 @@ export function render() {
const n0 = t0(); const n0 = t0();
const { const {
0: [n1], 0: [n1],
} = children(root); } = children(n0);
watchEffect(() => { watchEffect(() => {
setAttr(n1, 'id', undefined, foo); setAttr(n1, 'id', undefined, foo);
}); });
@ -121,7 +121,7 @@ export function render() {
1: [n3], 1: [n3],
}, },
], ],
} = children(root); } = children(n0);
const n2 = createTextNode(msg.value); const n2 = createTextNode(msg.value);
insert(n2, n1, 0 /* InsertPosition.FIRST */); insert(n2, n1, 0 /* InsertPosition.FIRST */);
setText(n2, undefined, msg.value); setText(n2, undefined, msg.value);
@ -139,7 +139,7 @@ export function render() {
const n0 = t0(); const n0 = t0();
const { const {
0: [n1], 0: [n1],
} = children(root); } = children(n0);
watchEffect(() => { watchEffect(() => {
setText(n1, undefined, ''); setText(n1, undefined, '');
}); });
@ -156,7 +156,7 @@ export function render() {
const n0 = t0(); const n0 = t0();
const { const {
0: [n1], 0: [n1],
} = children(root); } = children(n0);
watchEffect(() => { watchEffect(() => {
setText(n1, undefined, str.value); setText(n1, undefined, str.value);
}); });

View File

@ -20,7 +20,7 @@ const increment = () => count.value++
return (() => { return (() => {
const n0 = t0() const n0 = t0()
const { 1: [n1], 2: [n3], 3: [n5], 4: [n6], 6: [n7],} = children(root) const { 1: [n1], 2: [n3], 3: [n5], 4: [n6], 6: [n7],} = children(n0)
const n2 = createTextNode(count.value) const n2 = createTextNode(count.value)
insert(n2, n1) insert(n2, n1)
const n4 = createTextNode(double.value) const n4 = createTextNode(double.value)

View File

@ -30,7 +30,9 @@ export function generate(
{ {
code += `const n${ir.children.id} = t0()\n` code += `const n${ir.children.id} = t0()\n`
if (Object.keys(ir.children.children).length) { if (Object.keys(ir.children.children).length) {
code += `const {${genChildren(ir.children.children)}} = children(root)\n` code += `const {${genChildren(ir.children.children)}} = children(n${
ir.children.id
})\n`
vaporHelpers.add('children') vaporHelpers.add('children')
} }