0
respostas

A rota no Vue Router não funciona

Não aparece nada na tela quando eu tento acessar o localhost:8080/#/user também não aparece nenhum erro no console. Meu código:

main.js

import Vue from 'vue'
import App from './App.vue'

import VueResource from 'vue-resource';
import VueRouter from 'vue-router';
import { routes } from "./routes";


Vue.use(VueResource);
Vue.use(VueRouter);


const router = new VueRouter({ routes:routes });


new Vue({
  el: 'body',
  router: router,
  components: { App }
})

app.vue:

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

<script>
export default {

}
</script>

<style>
body {
  font-family: Helvetica, sans-serif;
}
</style>

index.html

<!DOCTYPE html>
<html lang="pt-br">
  <head>
    <meta charset="utf-8">
    <title>rave</title>
  </head>
  <body>
    <app></app>
    <script src="dist/build.js"></script>
  </body>
</html>

User.vue

<template>
    <div>
        Olá, mundo!
    </div>
</template>

<script>
    export default {

    }
</script>

<style scoped>

</style>

routes.js

import User from './components/users/User.vue';

export const routes = [
    { path: '/users', component: User }
];