vuejs/vue

useSlots&v-for related bugs

qiuqiuma opened this issue · 1 comments

"vue": "^3.3.4",
The following issues occur when I use the "default slot"
===(The first is a normal example)===
----define component-----
<template>
<div>
<slot></slot>
</div>
</template>
<script setup>
import { useSlots } from "vue";
const slots = useSlots();
const res = slots.default();
debugger
</script>
----Usage component----
<script setup lang="ts">
import Test from './compoents/Test.vue'
</script>
<template>
<div>
<Test>
<div>1</div>
<div>2</div>
<div>3</div>
</Test>
</div>
</template>

image

===(Next is the bug example)===
---When I use "v-for" to render the content---
<script setup lang="ts">
import Test from './compoents/Test.vue'
const arr = [1,2,3]
</script>
<template>
<div>
<Test>
<div v-for="(item,index) in arr" :key="index"> {{ item }}</div>
</Test>
</div>
</template>
The structure of the object has changed
image

Open an issue following the template on Vuejs/core. This is Vuejs 2