我正在处理一个Vue.js项目,遇到了一个错误,说“错误:无效的路由组件。”我无法找出此问题的根本原因。有人能帮我诊断和解决吗?
import { createRouter, createWebHistory } from "vue-router";
import Home from '../views/Home.vue'
const routes = [
{
path: "/",
name: "home",
component: "Home",
},
];
const router = createRouter({
history: createWebHistory(),
routes,
});
export default router;
<template>
<router-view />
</template>
<script setup>
</script>
<style scoped>
</style>
import { createApp } from "vue";
import router from "./router";
import "./style.css";
import App from "./App.vue";
createApp(App)
.use(router)
.mount("#app");
<template>
Home
</template>
<script setup>
</script>
1条答案
按热度按时间qcbq4gxm1#
看看
component
的值,它是一个字符串,它应该是对Home
导入的引用:给予一次机会。