Answer the question
In order to leave comments, you need to log in
Not rendering vue component, why?
Console warning:
runtime-core.esm-bundler.js?5c40:6873 [Vue warn]: A plugin must either be a function or an object with an "install" function.
warn @ runtime-core.esm-bundler.js?5c40:6873
use @ runtime-core.esm-bundler.js?5c40:3415
eval @ main.js?56d7:6
./src/main.js @ app.js:1100
__webpack_require__ @ app.js:854
fn @ app.js:151
1 @ app.js:1149
__webpack_require__ @ app.js:854
checkDeferredModules @ app.js:46
(anonymous) @ app.js:994
(anonymous) @ app.js:997
runtime-core.esm-bundler.js?5c40:6873 [Vue warn]: Failed to resolve component: router-view
at <App app=null apps= [] options= {mode: "history", routes: Array(2)} ... >
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
const app = createApp(App, router)
app.use(router)
app.mount('#app')
import Router from 'vue-router'
import Home from './views/Home'
// import { VueElement } from 'vue'
const router = new Router({
mode: 'history',
routes: [
{
path: '/',
component: Home,
},
{
path: '/todos',
component: () => import('./views/Todos.vue'),
},
],
})
export default router
<template>
<div>
<h2>Home page</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quod itaque
tempore reiciendis.
</p>
<a href="/todos">Todos</a>
</div>
</template>
<template>
<div id="app">
<h1>Todo applictaion</h1>
<hr />
<router-view></router-view>
</div>
</template>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
Answer the question
In order to leave comments, you need to log in
A plugin must either be a function or an object with an "install" function
import Router from 'vue-router'
Vue.use(Router)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question