[Vuejs]-Not loading vue file in Laravel 5.7 application

0👍

You need add App.vue

<template>
  <div>
    <router-link to="/dashboard" class="nav-link">Dashboard</router-link>
  </div>
</template>
<script>
  export default {
    // some code here if needed
  }
</script>

and then use it in main.js

require('./bootstrap'); // maybe better use import "./bootstrap"

import Vue from 'vue';
import VueRouter from 'vue-router';

import App from "./App.vue";
import Dashboard from './components/Dashboard.vue';
import Profile from './components/Profile.vue';
import ExampleComponent from './components/ExampleComponent.vue';

Vue.use(VueRouter)

window.Vue = Vue; // why you do that???

let routes = [
    { path: '/dashboard', component: Dashboard },
    { path: '/profile', component: Profile }
  ]

  const router = new VueRouter({
    routes // short for `routes: routes`
  });

Vue.component('example-component', ExampleComponent);
new Vue({
    router,
    render: (h) => h(App)
}).$mount('#app');

Leave a comment