The console in the vue3 project reported this error
reason: history is not defined in the router file
Solution:
Modify the following codes:
import { createRouter } from 'vue-router';
const router = createRouter({
routes,
});
to:
import { createRouter , createWebHashHistory } from 'vue-router';
const router = createRouter({
history:createWebHashHistory(),
routes
})
Read More:
- [Solved] Uncaught SyntaxError: The requested module does not provide an export named
- React Error: history is undefined [How to Solve]
- [Solved] vue-roter 4 Error: Error: Invalid route component/Uncaught (in promise) Error: Invalid route component
- [Solved] Vue3 Import element UI error: Uncaught TypeError: Cannot read properties of underfined…
- Vue Error: Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location
- Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to crrent location: “/home“
- [Solved] Uncaught (in promise) Error: Avoided redundant navigation to current location:
- [Solved] Uncaught (in promise) TypeError: XXX.a is not a constructor
- [Solved] UMI Project Error: uncaught at _callee3 at _calle3
- vue.config.js build Package UglifyJsPlugin to clear console and print console.log Error: `warnings` is not a supported option
- [Solved] Uncaught SyntaxError: Cannot use import statement outside a module
- The solution of calling$. Ajax successfully but the success method does not respond
- [Solved] Vue3 Configuration routing error: Catch all routes (“*“) must now be defined using a param with a custom regexp.
- [Solved] Vue Route Error: Uncaught TypeError: (0 , vue__WEBPACK_IMPORTED_MODULE_42__.defineComponent) is not a function
- [Solved] error:chunkgroup.addoptions:no option merge strategy for name
- [Solved] ajax Error: Uncaught SyntaxError: Unexpected end of JSON input
- [Solved] Uncaught ReferenceError: axios is not defined
- [Solved] Error: Transform failed with 1 error: error: Invalid option in transform() call: “jsx“
- [Solved] Uncaught SyntaxError: Unexpected token ‘<‘
- [Solved] JS Error: Uncaught SyntaxError: Illegal return statement