fix(compiler-vapor): don't setText for root element

This commit is contained in:
三咲智子 Kevin Deng 2024-01-19 22:50:07 +08:00
parent fc651f6905
commit 10f8cb4351
No known key found for this signature in database
GPG Key ID: 69992F2250DFD93E
3 changed files with 14 additions and 1 deletions

View File

@ -9,8 +9,9 @@ export const transformInterpolation: NodeTransform = (node, ctx) => {
const parentChildren = ctx.parent ? ctx.parent.node.children : []
const isFirst = ctx.index === 0
const isLast = ctx.index === parentChildren.length - 1
const isRoot = ctx.parent === ctx.root
if (isFirst && isLast) {
if (isFirst && isLast && !isRoot) {
const parent = ctx.parent!
const parentId = parent.reference()
ctx.registerEffect(

View File

@ -0,0 +1 @@
<template>{{ '1' }}</template>

View File

@ -0,0 +1,11 @@
<script setup lang="ts">
import { ref } from 'vue/vapor'
interface Task {
title: string
completed: boolean
}
const tasks = ref<Task[]>([])
</script>
<template>{{ tasks }}</template>