mardi 8 mai 2018

Components are not loading while history mode in vue js in laravel

I am new to vue js. All is working good. But When i changed mode to history, hash from url is removed but components are not loading, please help. this is app.js

window.Vue = require('vue');
import VueRouter from 'vue-router';



var index = Vue.component('index', 
require('./components/frontend/testingIndexComponent.vue'));
var component1 = Vue.component('component1', 
require('./components/frontend/testingComponent.vue'));


Vue.use(VueRouter);

const router = new VueRouter({
mode: 'history',    
routes: [
  { path: '/', component: index },
  { path: '/component1', component: component1 }
]
})
const app = new Vue({
router
}).$mount('#app')

this is web.php

Route::get('/{vue_capture?}', function () {
return view('index4');
})->where('vue_capture', '[\/\w\.-]*');

this is index4.blade.php

<body>
  <div>
    <h1>Header</h1>
        <!-- <a><router-link tag="li" to="projects">
            sdds
        </router-link></a> -->
</div>
<div id="app">
    <a><router-link  to="component1">
            sddsdadadssa
        </router-link></a>
    <router-view>

    </router-view>
</div>
<div>
    <h1>Footer</h1>
</div>
<script type="text/javascript" src=""> 
</script>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire