Route Error in Vue js

Asked

Viewed 257 times

0

My App.Vue

<template>
  <div id="app">
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: 'app',
  data () {
    return {

    }
  }
}
</script>

<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>

My Home.Vue Component

<template>
  <div>
    <h1>Home</h1>
  </div>
</template>

<script>
export default {

}
</script>

<style>

</style>

My main.js

import Vue from 'vue'
import App from './App.vue'
import VueRouter from 'vue-route';
import Home from './components/home/Home.vue';

Vue.use(VueRouter);


var router = new VueRouter({
  routes: [
    { path: '/', component: Home },
  ]
})

new Vue({
  el: '#app',
  router,
  render: h => h(App)
})

I’m having this mistake, I’m using the Vue-route

Typeerror: Vue.Directive is not a Function

1 answer

1


From what I could see import of VueRouter is spelled wrong, missed a r

Should be:

import VueRouter from 'vue-router'
  • Vlw, I just realized that besides being spelled wrong I gave a npm install also with the wrong name.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.