I\'m building an app with laravel and VueJs and I was wondering how to pass a url parameter like the user slug or the user id to vuejs in a proper way to be able to use that pa
I suppose you are building a component. Let's say, you have a button inside that component and when is clicked, you wanna perform an action (AJAX request, or just redirect).
In this case you pass the URL as parameter to the component and you can use it inside.
HTML:
Your component JS:
export default {
props: {
loginUrl: {required: true},
},
...
}
Then you can access the param in the component as this.loginUrl
.
Please notice that param name difference in HTML part as dash-notatinon and in JS as camelCase.