mostafalaravel
7 months ago
33
5
Vue

Vue Router not working

Posted 7 months ago by mostafalaravel

Hello, I try to make router to my app , but I receive this error message :

[Vue warn]: Unknown custom element: <router-view> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <App> at src/App.vue
       <Root>

here the App vue :

<template>
  <div id="app">
    <!--<HelloWorld msg="Welcome to Your Vue.js App"/>

    -->
    <router-view/>

  </div>
</template>

<script>

import './assets/css/main.css'

export default {
  name: 'app'
}
</script>

<style>
#app {
}
</style>

main.js

import Paginate from 'vuejs-paginate'

Vue.component('paginate', Paginate)

import Vue from 'vue'

import Router from 'vue-router'

import App from './App.vue'

import axios from 'axios'

import VueAxios from 'vue-axios'

import home from '@/components/home'

Vue.config.productionTip = false

new Vue({

    render: h => h(App),
}).$mount('#app')

Vue.use(VueAxios, axios)

Vue.use(require('vue-moment'))

Vue.use(Router)

export default new Router({
    routes: [
        {
            path: '/',
            name: 'home',
            component: home
        }
    ]
})

Thanks

Please sign in or create an account to participate in this conversation.