Skip to content
Advertisement

create a route with vue router

I have some issues creating a router using router on vuejs. My file main.js was just like the code below and then when I changed to add some routes I got the error below

MAIN.JS BEFORE (WORKING WELL)

JavaScript

MAIN.JS AFTER

JavaScript

ERROR

JavaScript

The pages don’t render anymore. I’ve been a while trying to fix it. Anyone knows what it could be? Thanks

JavaScript

Advertisement

Answer

Vue 3 does not have direct access use method. That’s the issue.

JavaScript

Try like this

JavaScript

Checkout Vue 3 route handling here & Breaking changes here

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement