Questions tagged [vue-router4]

190 questions
0
votes
0 answers

Vue 3 Vue-router 4 Composition API - Calling router.push outside of component not working

In my Vue 3 project, i use the composition API of Vue and i have axios defined as a plugin in plugins/axios.js like this: import axios from "axios"; import { useRouter } from "vue-router"; import { useErrorStore } from…
0
votes
0 answers

Problems with vuex: Uncaught (in promise) TypeError: _ctx.getProduct.image_url is undefined

I'm trying to load a product's data, passing props through the Vue Router, this is my code: ...store/modules/products_manager.js import axios from 'axios'; const BASE_URL = "http://127.0.0.1:3000/" const state = { product: [], products:…
igorfz
  • 11
  • 2
0
votes
0 answers

Vue router not routing with URL paths

So I'm working with Vue 3 and Vue Router 4 and I'm having an issue when running my code with webpack-dev-server. Whenever I run my app webpack-dev-server --mode development the landing page looks great and loads everything from my App.vue file.…
0
votes
1 answer

Vue 3 Composition Api , Vue-router 4 Naigation guards throw an Error when using it

When I try to use navigation guard from Vue-router 4, my code is no longer working it show a errors with undefined (push) from Pinia store router.push('/'). Here is my code: import { createRouter, createWebHistory } from "vue-router"; import…
0
votes
0 answers

How to get the current route name inside a pinia store?

I'm creating an application that needs to query different collections for each view. I believe that the simplest way to do this would be to assign the name of the route to a variable that corresponds to the name of the collection in the Firestore…
0
votes
0 answers

Vue3: redundant route.push, unexpected route redirect after some navigation

Good day all ! I have an unwanted redirect occurring from a manual route.push, after some navigation steps, as if it had been cached in history stack. Edit: the only alternative i have found, is to no longer need home dependency and copying it to…
MTroy
  • 897
  • 9
  • 20
0
votes
0 answers

Vue router: check if two routes are "siblings"

I have two route objects for which I'd like to find out whether they are "sibling routes". Two routes constitute as sibling route (according to my definition), if they have the same name and their parent parameters were the same (e.g. /foo/1/baz/2…
orange
  • 7,755
  • 14
  • 75
  • 139
0
votes
0 answers

Vue 3 scrollBehavior async scrolling

I'm trying to resolve a promise in the scrollBehavior function in vue 3. The vue router documentation is vague in regards to async scrolling (https://v3.router.vuejs.org/guide/advanced/scroll-behavior.html#async-scrolling). With vue 2 I would have…
0
votes
1 answer

How can I create Side Navigation like with border on left like image?

I want to create side navigation like this in Vue3, with active class. I want to add border-left like in the image. Currently I have it like this. SideBar.vue
0
votes
0 answers

How to limit param to single string instead of array of strings (string[])

I have the following route config: const routes = [{ path: "/random/:id", component: Random }]; And this is the Random.vue component: