[Vuejs]-Laravel + Vue.js MPA/SPA hybrid structure suggestions and thoughts

0πŸ‘

use spa pattern.

in spa only one time your index.blade.php file load then load .vue
file

so how example: this is your index.blade.php file

@extends('layouts.master')
@section('content')
<body id="vue_root">
    <vue-router></vue-router>
</body>
@endsection

this is your hotel.vue file where

   list,add,edit,delete functionality 

this is your room.vue file where

  book room,check room available ,etc. functionality.

now if you click on hotel link then just load hotel.vue file with his functionality
and send ajax request to server(hotelcontroller) and get hotel list with response in json ..(not reload whole just reload element)

if u click in room link then load only room.vue file with his
functionality and load room dependency ..(not reload whole just reload
element)

using vue-router in vue u can do like this……

for more detail see this link and also this link

Leave a comment