【发布时间】:2021-02-26 08:56:18
【问题描述】:
当我尝试在组件中的组件上使用 v-for 指令时,出现上述错误。
这正在工作并迭代存储在参与者中的一些数据
<template>
<div
v-for="(participant, index) in participants"
v-bind:key="index"
>
hello world
</div>
</template>
但是改成这个会给我上面的错误。
<template>
<Step1Item
v-for="(participant, index) in participants"
v-bind:key="index"
>
hello world
</Step1Item>
</template>
<script>
import Step1Item from "./Step1Item.vue";
export default {
name: "Step1",
components: Step1Item,
[...]
</script>
组件是:
<template>
<div>
{{ name }}
</div>
</template>
<script>
export default {
name: "Step1Item",
props: {
name: String,
},
};
</script>
【问题讨论】:
-
Step1Item 和 Step1 在同一个文件夹中吗?
-
是的,现在是。
-
你也可以看看这个,为我工作stackoverflow.com/questions/66024797/…
-
看看这个,它对我有用stackoverflow.com/questions/66024797/…
标签: vue.js vue-component