All Questions
Tagged with vue-composition-api vue-script-setup
108 questions
1
vote
0
answers
75
views
How to stop executing rest of code in script setup syntax in composition api Vue 3
I have a page template that contains the following sub-component:
<template>
<ManageVacanciesAndMatchesTabVacancies @loading-data="setIsTabDataLoading" />
</template>
And ...
4
votes
1
answer
2k
views
why do I get this error when I try to use multiple defineModels in vue.js?
I am trying to use the v-model directive on two input elements. However, I am getting the following error: duplicate model name "modelValue". Below I show the code that generates this error:
...
1
vote
1
answer
48
views
Component isn't updating from computed value [duplicate]
I have a generic component linked to a computed value to simulate routing.
There is a current page property, and three links, whenever the user clicks on a link, that property gets updated via the ...
7
votes
1
answer
11k
views
How to use defineModel (in Vue 3.4) for uses other than inputs
The examples given for defineModel in the Vue docs all relate to uses for data inputs. I was wondering if this construct could also be used elsewhere, thus avoiding the somewhat cumbersome props/emit ...
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
30
views
VueJS passing parameter to bound property
I want to track the state of several buttons without having a tracker variable and function for each.
So I want to pass a parameter through to a computed property, something like this:
<div class=&...
-1
votes
1
answer
84
views
Blank background-image in vue.js
For a website, i want 70% of the page to be covered with an image. However the image is just blank.
I use Vue.js as my frontend. Here is the code that results in a blank space:
<script setup lang=&...
2
votes
1
answer
495
views
How to make vue testing library recognize script setup?
So I have an existing project where I wanted to add testing suite with jest + vue testing library.
Added necessary libs and configs and jest basic calc sum test passes.
After that importing basic vue ...
0
votes
1
answer
983
views
Is there a way to pass a Object as param to router in VueJS 3 (Composition API + script setup)?
In this project, there's the user which is a js object, like this:
const user = {
"ID": id,
"NAME": name,
"EMAIL": email,
...
}
And here's the router on VueJS:
{
...
1
vote
0
answers
958
views
Using TipTap with Vue3+Composition API+TS
I'm using TipTap with Vue3, Composition API and typescript (script setup) and I've faced a problem. There is no documentation how to implement https://tiptap.dev/examples/interactivity vue ...
2
votes
1
answer
2k
views
Vue 3 Component losing reactivity
I've been learning Vue 3 for the past month or so and have gotten quite far but I can't fix this no matter what I've tried. I know I'm losing reactivity but I can't figure out how and it's driving me ...
0
votes
1
answer
725
views
How can I use a custom name for a vue component?
The component I want to use with a custom name is defined as:
@/components/MyCustomName.vue
<template lang="">
<div>I'm here</div>
</template>
<script>
...
1
vote
1
answer
680
views
Why some variables are inacessible in onMounted Lifecyle Hook in vue3 composition API?
I'm kinda new to composition API in vue3 and I'll be glad if someone could explain to me why...
this works:
<template>
<h1>{{ foo }}</h1>
</template>
<script setup>
...
1
vote
0
answers
344
views
How to use jest.spyOn in wrapper.vm function?
I'm using vue-test-utils to test my components. They are written in composition API with <script setup> tag. I'm facing some difficulties when spying the functions to test if they were called or ...
0
votes
1
answer
498
views
How to load a dynamic image from a url in Nuxt3?
I have a nuxt 3 component which fails to load dynamic image that i'm getting from a specific URL(auth0 images).
My template looks like so:
<template>
<img class="h-28 w-28 rounded-...