#Is it possible to use this.$inertia in setup()?

1 messages · Page 1 of 1 (latest)

stone jacinth
#

I am trying to use this.$inertia.visit() in the setup() of Vue, but that doesn't work.
Does someone know how I can make it work?

tired plume
#

Yes, that does not work, and won't work. You'll have to use Inertia, as per the docs

#

setup in Vue has no this context

#
import { Inertia } from '@inertiajs/inertia'
Inertia.visit()
stone jacinth
#

Ah i see!

#

Just had to import it

#

I tried doing it without the import, I knew this. wouldn't work, but I forgot to import it specifically (thought it happened globally) facepalm

#

Thank you very much Robert!

tired plume
#

Haha no worries 🙂 Can be a bit confusing as the docs mostly use the options API