What is ?

See Special Attributes – key It can also be used to force replacement of an element/component instead of reusing it. This can be useful when you want to: Properly trigger lifecycle hooks of a component Trigger transitions $route.fullPath is defined as The full resolved URL including query and hash. If you bind key to $route.fullPath, … 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

How to add external JS scripts to VueJS Components?

A simple and effective way to solve this, it’s by adding your external script into the vue mounted() of your component. I will illustrate you with the Google Recaptcha script: <template> …. your HTML </template> <script> export default { data: () => ({ ……data of your component }), mounted() { let recaptchaScript = document.createElement(‘script’) recaptchaScript.setAttribute(‘src’, … Read more