Vue router with webpack basic example Vue router with webpack basic example vue.js vue.js

Vue router with webpack basic example


There are several things wrong here.

First, routes is an array of objects.

const routes = [  {path: "/", component: Message}]

Second, for clarity, define your router outside of the Vue definition.

const router = new VueRouter({  routes})

In your Vue definition, the router must be called router.

new Vue({    el: '#app',    router})

Finally, in your template for #app, you'll need a <router-view></router-view>.