[Vuejs]-How to solve vue-router Uncaught TypeError?

2👍

You need to replace the mode: 'history' with history: createWebHistory() property, as the mode property is deprecated in version 4.

For more resources.

https://router.vuejs.org/guide/migration/index.html#new-history-option-to-replace-mode

This is a resource for migration from Vue 2 to Vue 3

https://router.vuejs.org/guide/migration/index.html

👤Mina

1👍

The router instance should be created in this way :

import { createRouter,createWebHashHistory } from 'vue-router';
....
const router = createRouter({
 history: createWebHashHistory(),
  base: process.env.BASE_URL,
  routes,
});

Leave a comment