Proper Use of route() in Composition API/SFC #492
-
I've been using Everything works, just wanted to make sure it's proper. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 13 replies
-
Inside your templates you should be able to keep using I didn't know about Otherwise, you can import |
Beta Was this translation helpful? Give feedback.
-
At the moment I use provide/inject vue functionality that works in composition api. In setup() you can easilly do In app.js or ssr.js |
Beta Was this translation helpful? Give feedback.
Inside your templates you should be able to keep using
route()
normally, and if you're using the@routes
Blade directive thenroute()
should actually also be available globally, which means you can use it directly even in thesetup()
function.I didn't know about
getCurrentInstance()
, if that works then I think it's totally fine to do that.Otherwise, you can import
route
in each component and just use it like a regular function, see #454 (comment) for some detailed examples. We're planning to provide auseRoute()
hook eventually to make this easier too.