Silently update url without triggering route in vue-router

Without reloading the page or refreshing the DOM, history.pushState can do the job. For example: add this method in your component or elsewhere to do that: addHashToLocation(params) { history.pushState( {}, null, this.$route.path + ‘#’ + encodeURIComponent(params) ) } Then anywhere in your component you can call addHashToLocation(‘/my/new/path’) to push query params to the window.history stack. … Read more

get all routes in a vue router

In Nuxt, the routes are generated automatically so I couldn’t do what @zxzak suggested. Here’s what you can do in that case. <template v-for=”item in items”> <b-nav-item :to=”item.path”> {{item.name}} </b-nav-item> </template> export default { created() { this.$router.options.routes.forEach(route => { this.items.push({ name: route.name , path: route.path }) }) } , data() { return { items: [] … Read more

vue-router – How to get previous page url?

All of vue-router’s navigation guards receive the previous route as a from argument .. Every guard function receives three arguments: to: Route: the target Route Object being navigated to. from: Route: the current route being navigated away from. next: Function: this function must be called to resolve the hook. The action depends on the arguments … Read more

vuejs application with different layouts (e.g. login layout, page layout, signup etc.)

I think I found a solution. The approach has App.vue containing only <router-view></router-view> and then including different components that represent layout (if needed, containing <router-view> and subroutes). I found a project using it in that way here. I think it keeps things more clean and organised. IMHO, hiding all elements which define layout structure (all … Read more

How to get current route name in Nuxt 2 and 3?

yes you can use vuejs route objects like $route.name or $route.path $nuxt.$route.path return current path $nuxt.$route.name The name of the current route, if it has one. Route Object Properties A route object represents the state of the current active route. It contains parsed information of the current URL and the route records matched by the … Read more

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