Skip to content

Vue/Inertija/Vite don't work with @routes? #688

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

You must be logged in to vote

Inertia and Vue work fine with @routes. Making any global JavaScript function/variable available inside the <template> of Vue single-file components, whether that's route() or console.log() or anything else, requires some additional setup. You can either do that setup yourself or you can use Ziggy's Vue plugin, which does it for you.

Inside the <script> of your components, and anywhere else in your JS code, route() should be available with the setup you showed above.

I agree that note in the docs is a bit misleading, I'll tweak that wording.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
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