-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing backend data to Vue #10
Comments
In your
And in your
|
That's all true and correct for the authenticated user, as the shared data doesn't change for all admin routes. By now I'm passing the breadcrumbs collection to each page component and then to the root layout component where breadcrumbs are rendered. Ideally I would like to access them globally. |
That would be more clean approach, yes. As far as I understood it from Twitter @reinink is dropping Turbolinks entirely and going with a straight Vue and Laravel approach. Previously he mentioned something along the lines of "TurboVue", but I swear I saw a tweet stating that it will be dropped for a more favorable and straightforward solution. Using this repository as a base seems a bit clunky when it comes to issues like this. I'm currently using this in one of my projects, but have prepared myself for a refactor when the aforementioned solution comes. |
For those interested, I now do something like this:
I'm creating the layout component and passing the page component name as prop:
In the layout component I have a dynamic component that renders the passed page component:
where
|
What this |
@zefexdeveloper That's a Blade directive for outputting a PHP variable as JSON. |
The same for |
No, If you're looking at this repo, I highly recommend checking out my Inertia.js project. That's really where the thinking from this repo (blog post) lead me. |
@reinink Thank you very much, I heard about Inertia.js before and it looks amazing, I will definitely take a look and probably refactor the project later. Right now I'm using inline components with Vue because it sucks to pass down localization information down from Laravel to Vue components. It will do the trick now, gotta get things done but later I will definitely refactor and make it better. |
I wonder what is the best way to pass some data like logged-in user or breadcrumbs created by laravel to Vue.
By now I'm merging all of the data and passing it through props to each of the page components. But it feels like a hack and I think there might be a better solution.
What would you suggest?
The text was updated successfully, but these errors were encountered: