All Questions
Tagged with vue-composition-api vue-router
58 questions
0
votes
0
answers
36
views
404 error when refreshing browser in Vue app
I have a Vue 3 app that utilizes the Composition API, Vue Router w/ history mode, Vite, Vuetify and Typescript.
When I refresh the browser on a different page, I get a 404 error, and I'm pretty ...
0
votes
0
answers
16
views
Data Fetching with suspense and route params in Vue3 Composition Api
this is children component
<script setup>
import { computed, ref, watch, watchEffect } from 'vue'
import { useRoute } from 'vue-router'
import dataSource from '../../data.json'
import ...
1
vote
1
answer
1k
views
Vue3 Composition API: Error: Codegen node is missing for element/if/for node. Apply appropriate transforms first when using named slots in router-view
I am currently in the process of rewriting my Vue code in all of my apps but am running into a rather annoying error that I cannot seem to decipher. Let me explain to you first what I am trying to do....
-1
votes
1
answer
34
views
How to check param route in router
How can I check a param of a route from a variable like so:
const SUB_ROUTES = {
GLOBALSTAR: "globalStar",
PARKINGMULTIPEAJE: "parkingMultipeaje",
RESERVAS: "...
0
votes
1
answer
4k
views
Vue watchers and reactivity
In my vue app, I want to watch route changes, and then react to the change. Here is an example where I simulate a route change.
<script setup>
import { ref, watch } from 'vue'
import { ...
0
votes
1
answer
239
views
Passing parameters from component to another using Vue3 Composition API and vue-router .replace function
With Option API I was able to do this:
In ComponentA:
this.$router.replace({ name: 'ComponentB', params:{data: myObject} });
In ComponentB:
console.log(this.$route.params); // this outputs myObject
...
0
votes
1
answer
589
views
Error implementing Navigation Guard in a Vue 3 + Quasar + TypeScript project
I am working on an application using the Quasar Framework along with Vue 3 (utilizing Composition API with syntax) and TypeScript. I am attempting to implement a Navigation Guard in my routes.ts file ...
0
votes
1
answer
89
views
Variable keeps an old value
I have a problem in my Vue app: when I click on a product, the navigationAndChange function is triggered, which gets the ID of that product and takes me to the page with that product. There are ...
1
vote
2
answers
96
views
go to specific component view from router-link
Is there a way to got to a specific component from route that it has several components?, I search the docs but there is nothing about it
here you have my shortened routes in app router:
const routes: ...
1
vote
1
answer
695
views
How to prevent view re-rendering inside dynamic layout when route (and therefore dynamic layout) is changed in Vue 3?
When I navigate from the page from MainLayout to the page that has CallLayout, Call view is re-rendered.
AppLayout.vue:
<script lang="ts" setup>
import { markRaw, shallowRef, watch } ...
2
votes
1
answer
964
views
Vue router in composition api?
In Nuxt 2.16, I'm trying to access the useRouter composable with import {useRouter} from 'vue-router', as in this question, but the import leaves useRouter undefined.
When I import * as r from 'vue-...
6
votes
1
answer
6k
views
Issue with mocking Vue Router in Vitest
i'm learning Vue 3 using composition api, and im very new to Vitest aswell (i know it uses Vue Test Utils though).
So, in short i'm having a problem where I mock the Vue Router, trigger click on a ...
1
vote
0
answers
374
views
How to get access to the Vue Router custom props via composition API?
Vue Router doc states that custom object can be passed to the component via props key.
When props is an object, this will be set as the component props
as-is. Useful for when the props are static.
I ...
0
votes
3
answers
1k
views
In Vue3, how can I access properties similar to those in "beforeRouteEnter" in the Composition API?
I am working with a Vue project (Composition API, Single-File Components) where I want to access data about the Vue page I came from. I would really want to access all the data included in the ...
0
votes
0
answers
152
views
Vue3 Component name not parsed correctly
I have the following App.vue that has a dynamic layout setup:
<template>
<component :is="layout" />
</template>
<script setup lang="ts">
import { ref, ...