How to pass an object as props with vue router?

It can work by using props’s Function mode and params Vue 2 demo: https://jsfiddle.net/hacg6ody/ when adding routes, use props’s Function mode so that it has a default property user and it will add route.params as props. { path: ‘/create’, name: ‘create’, component: CreateComponent, props: (route) => ({ user: userData, …route.params }) } params passed in … Read more

Vue.js – How to remove hashbang #! from url?

In Vue 3, you’d want to use createWebHistory for the history option. import { createRouter, createWebHashHistory } from ‘vue-router’ const router = createRouter({ history: createWebHashHistory(), // … }) In Vue 2, you’d want to set mode to ‘history’. const router = new VueRouter({ mode: ‘history’, // … }) Make sure your server is configured to … Read more

vue-router — Uncaught (in promise) Error: Redirected from “/login” to “/” via a navigation guard

I spent hours debugging this and got to the following results for the ugly Uncaught (in promise) Error: Redirected when going from … Error. Note that the error is not for the “redirect”. It’s for the initial caller of the first navigation. Keep reading… It’s by design. Why? Read this comment. TL;DR: Let’s say you … Read more