All Questions
Tagged with vue-composition-api ref
18 questions
0
votes
1
answer
297
views
Are there any issues/concerns with assigning computed values to a ref property in Vue?
I'm reviewing some Vue code where the developer has assigned a computed value to a ref property. I've never seen this done before, and although it works, it seems odd to me.
Are there any potential ...
1
vote
1
answer
4k
views
Why Vue 3 ref is not updating
I have searched this issue and tried all the things but did not work for me. I am using Vue 3 ref and it needs to be updated after calling the Axios with the response but it is not getting updated ...
3
votes
0
answers
633
views
Handling reactive typescript objects in vue 3 that contain Refs
I am trying to use the Composition API of vue 3, and struggle to handle reactive typescript objects. As I understand from the documentation, when you make an object reactive, vue wraps it and all ...
1
vote
1
answer
143
views
Typing the Ref Composition API Vue
how could I type correctly my Ref firstName as string? There are 2 errors underlined, in the template - {{ firstName }}, and in the script - const firstName = ref('') as String. I suppose it has to do ...
1
vote
1
answer
523
views
How to make single property in array reactive when using `ref` instead of `reactive`?
I have a component that displays rows of data which I want to toggle to show or hide details. This is how this should look:
This is done by making the mapping the data to a new array and adding a ...
0
votes
1
answer
432
views
Vue.js Composition API vs Options API - posts ref in a v-for loop
I'm still new to VueJS, and I cannot figure this one out.
I have a page that loads with axios from wordpress my posts:
export default {
data() {
return {
postsUrl: "https://localhost/...
0
votes
1
answer
574
views
How use function ref inside swiper slide
I am trying to use function ref inside swiper slide, but get duplicated results.
<swiper-slide>
<first-step :ref="(el) => { steps.push(el)}" />
</swiper-slide>
<...
4
votes
1
answer
7k
views
How to use a template ref on a custom component in vue 3 compositon api
When I try to get the ref of my custom components it results in:
Proxy {__v_skip: true}
[[Handler]]: Object
[[Target]]: Proxy
[[IsRevoked]]: false
but works just fine when replacing d-icon-button ...
2
votes
1
answer
1k
views
Vue 3 multiple v-model from child component return empty result
I have multiple input from child component that I want to submit from parent component
Parent Component:
<EmployeesPersonalData
v-model:fn="fn"
v-model:ln=&...
5
votes
1
answer
4k
views
what is the correct way of assigning vue state (ref()) to each other?
I am a little confused about using ref() in vue 3 (script setup) because of the ref().value.
what I want to know is should I use ref().value = ref().value or ref()=ref() I provide an example:
<...
0
votes
2
answers
3k
views
Vue js - ref within v-for loop always returning null
I am trying to access an element in Vue as I want to see when it's class changes (I'm using Bootstrap so I want to watch for when a class changes to shown). The problem is that as soon as I put a ref'...
0
votes
1
answer
377
views
vue3 can I cange composition api ref type?
if I have a props.id array like this from father component to prop another components
<components id="1"></components >
<components id="2"></components >
&...
47
votes
8
answers
54k
views
can't use template ref on component in vue 3 composition api
I want to get the dimensions of a vue.js component from the parent (I'm working with the experimental script setup).
When I use the ref inside a component, it works as expected. I get the dimensions:
/...
1
vote
3
answers
3k
views
Vue 3 composition API - ref doesn't work in npm package
I have this very simple Vue 3 component. Everything works fine. value changes every 0.5s (console.log is being called) and the value changes in browser every 0.5s as well.
<template>
<pre&...
0
votes
2
answers
14k
views
Vue 3 composition API get value from object ref
I have a ref:
const editItem = ref<object | null>(null)
Here's an example value for it:
{
id: 1,
title: 'Harry Potter',
author: 'J.K. Rowling',
created: '30-08-2000',
}
If I run ...