老师这是怎么回事啊
来源:3-5 Vue-Router 路由的理解和使用(1)
球球不一般
2022-10-10 19:04:49
<template>
<div>
<input v-model="inputValue" />
<button class="button" @click="handleAddItem">提交</button>
</div>
<ul>
<list-item v-for="(item, index) in list" :key="index"
:msg="item"
/>
</ul>
</template>
<script>
import { reactive, ref } from "vue";
import listitem from './components/listitem.vue'
export default {
name: "App",
components: {
listitem
},
setup() {
const inputValue = ref("");
const list = reactive([]);
const handleAddItem = () => {
list.push(inputValue.value);
inputValue.value = '';
};
return { handleAddItem, inputValue, list };
},
};
</script>
<style>
.button{
margin-left: 20px;
color: red;
}
</style>
<template>
<li class="button">{{ msg }}</li>
</template>
<script>
export default {
name: 'listitem',
props: {
msg: String
}
}
</script>
<style >
</style>
1回答
好帮手慕久久
2022-10-11
同学你好,报错提示helloWorld.vue这个组件找不到。猜测同学代码某个位置引入了helloWorld.vue,但是项目文件夹中并没有helloWorld.vue这个文件,所以报错了。
建议检查代码,找到helloWorld.vue的引用,然后删除掉:
修改后,如果还有报错,建议把所有文件的代码全部粘贴出来,不要截图。粘贴代码时,标注一下代码对应的文件名,这样老师可以更快的找到问题所在。
祝学习愉快!
相似问题