Skip to content

Problems with making route call, console error. #486

Answered by bakerkretzmar
alexv96 asked this question in Q&A
Discussion options

You must be logged in to vote

Ok a couple things—first, because you're using the @routes Blade directive, you can just remove all the Ziggy setup from your app.js and webpack.mix.js if you want to. The route() helper is already available globally.

If you do choose to load Ziggy as a Vue plugin, you have to import ZiggyVue, not route:

- import { route } from 'ziggy';
+ import { ZiggyVue } from 'ziggy';

- Vue.use(route,Ziggy);
+ Vue.use(ZiggyVue, Ziggy);

You may also need to change your alias to ...ziggy/dist/vue, or import ZiggyVue from 'ziggy/vue.

Then, route will be accessible as a method on all your components. Inside templates you can just call route(), but inside the <script> tags of the Vue component, like in yo…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by bakerkretzmar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants