[Vuejs]-Laravel Vue.js – how to use blade suntax in axios URL

0👍

Unfortunately you cannot use blade syntax within Vue unless you are writing the Vue code directly in the blade template, which would not be best practice. One thing I have found helpful is to write out all my Laravel API routes in a google docs so they are easier to refer to when referencing them in Vue. I hope that helps!

👤L. Fox

0👍

There is no way of doing this without a .blade file. there is no support given for vue components to use laravel routes dynamically. but you could use some third party packages to achieve this something like Ziggy

https://github.com/tightenco/ziggy

-2👍

You can only use blade syntax, if you’re in a .blade file.

You have to statically set this route or others when calling a API

NOT RECOMMENDED:
Or you can define a js variable in your “master” blade file, which you’re then using in the Register.vue file.

👤Jesper

Leave a comment