p0t4t0
114
0
Vue

Hybrid MPA with Vue?

Posted 11 months ago by p0t4t0

I've noticed most of the websites I visit don't fully go with the "SPA" approach but instead a somewhat of a mix of a traditional website (wherein pages actually load) and single page apps, is this a good idea? If so, how would Vue "look like" on the front end? For example I have two pages Home and Products. On the home page I return a blade template but on the Products page I also return a blade template except in that template I am loading up Vue. While that works, I am faced with a slight problem. How am I able to pass the category listed in the url to the Vue instance so it knows which products to load? One way I thought of was on the products.blade.php file I added a <script>window.category = {{ Request::segment(1) }}</script> the url would look like this site.com/category-1now I have access to the category and can load the products that belong to that category with axios but I am wondering if this is advisable.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.