Vue.js scroll to top of page for same route

You can’t do this through vue-router, but you can add a scroll-to-top method to every router-link. Just create a method like this: methods: { scrollToTop() { window.scrollTo(0,0); } } Add it to the link: <router-link @click.native=”$scrollToTop”> If you want to use it outside of your footer too, it’s better to add it to the Vue … 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

VueJs get url query

I think you can simple call like this, this will give you result value. this.$route.query.page Look image $route is object in Vue Instance and you can access with this keyword and next you can select object properties like above one : Have a look Vue-router document for selecting queries value : Vue Router Object

How to change page titles when using vue-router?

You can use a navigation guard with the router definition: import Vue from ‘vue’; const DEFAULT_TITLE = ‘Some Default Title’; router.afterEach((to, from) => { // Use next tick to handle router history correctly // see: https://github.com/vuejs/vue-router/issues/914#issuecomment-384477609 Vue.nextTick(() => { document.title = to.meta.title || DEFAULT_TITLE; }); }); You’ll need to change your export to: const router … Read more

How to get current name of route in Vue?

You are using computed incorrectly. You should return the property in the function. See the docs for more information. Here is your adapted example: computed: { currentRouteName() { return this.$route.name; } } You can then use it like this: <div>{{ currentRouteName }}</div> You can also use it directly in the template without using a computed … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)