Get 'id' from '$route.params'-URL to call it in useQuery

I’m working on a simple blog, I’m using Vue3 and Villus to send GraphQL queries. I build a component that shows all my posts. This works fine, in this component I send the ID in the URL for a single Post. For that, I build a blogpost_gql component. I need the ID for a GraphQL… Read More Get 'id' from '$route.params'-URL to call it in useQuery

Button for redirecting to url

so I have a button here that only clickable, but won’t redirect to URL. Any ideas? Thank you! <button class="w-max h-min flex justify-center items-center px-3 py-2 bg-white text-tersiary rounded-xl"href="url here"@click="onclick">{{ btnText }}Button Text!</button> >Solution : If you’re using vue router you could do : <button class="…" @click="$router.push(url here)">{{ btnText }}Button Text!</button>

Vue.js – Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'product')

I’m currently working on an eCommerce app using Django and Vue.js and I am currently trying to find out why my CartItem.vue component is not working. Its suppose to display the product, product price, the number of products selected, and the total price of the number of products selected. <template> <tr> <td> <router-link :to="item.product.get_absolute_url">{{ item.product.name… Read More Vue.js – Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'product')

( Nuxt's Vue-router ) How to differentiate path ending with "/" and without

Using the extendRoutes attribute for nuxt’s router, I am attempting to differentiate paths ending with a slash and paths that do not. This is due to how the CMS we are using handles paths. I could differentiate them by distinguishing the overview page as a path ending in /all or /overview, but it’s not ideal.… Read More ( Nuxt's Vue-router ) How to differentiate path ending with "/" and without

Vue <a> tag href attribute splicing

My current url is http://localhost:8080/component, and in this page I have an <a> tag <a :href="’/detail/’ + comp._id"></a> When comp._id is determined, for example it is 6221add333182348e1d70104. I want the URL to jump to http://localhost:8080/component/detail/6221add333182348e1d70104 when I click on the link. But actually it is http://localhost:8080/detail/6221add333182348e1d70104. How can I achieve this ? >Solution : You… Read More Vue <a> tag href attribute splicing

How to change the logotip of pages when using vue-router?

<img v-if="visibl" :class="{logoB:visible}" src="@/assets/images/svg/logo-footer.svg" alt=":(/> data() {emphasized text return { visible: false, }; }, >Solution : You can add watch to your router in component, So: <template> <div> <img v-if="visible" :class="{logoB:visible}" src="@/assets/images/svg/logo-footer.svg" /> </div> </template> script part here export default { name: "MyComponent", data() { return { visible: false } }, watch: { $route: {… Read More How to change the logotip of pages when using vue-router?