Questions tagged [vue-options-api]

44 questions
17
votes
2 answers

Vue.js: watch array length

How can I watch an array length using Vue.js?
Alfred Huang
  • 17,654
  • 32
  • 118
  • 189
13
votes
1 answer

Do I have to use the Composition API in Vue 3, or can I still do things the "Vue 2" way?

Is it possible to install Vue 3, but still do things the "Vue 2" way? In other words, I see that Vue 3 has the new Composition API, but is that optional or the required way of doing things in Vue 3? For some reason, I was thinking that Vue 3 still…
HartleySan
  • 7,404
  • 14
  • 66
  • 119
10
votes
1 answer

I keep getting "maximum recursive updates exceeded" in Vue when using axios and v-for

I am building an ecommerce site, and I created a component for product-card. I imported that component into the home page so I can display a list of products. I declare a variable of products in the data(){} and also create a beforeMount and put my…
Keenlabi
  • 163
  • 1
  • 2
  • 11
8
votes
4 answers

Migrating from vue2 with property-decorator and class style syntax to vue3

I maintain quite a large vue2 project, which among other libraries makes use of Vuetify, vue-class-component, vue-property-decorator and typescript. Example component: (The component is simplified and not compilable for the sake of displaying the…
Farsen
  • 1,387
  • 3
  • 21
  • 48
3
votes
1 answer

What is the Vue Options API?

I know that one of the main features of Vue 3 is the Composition API, which is an alternative to the old Vue Options API. But I can't seem to find a simple text definition of the Options API - what is it?
nCardot
  • 5,992
  • 6
  • 47
  • 83
2
votes
1 answer

Vue 3's Provide / Inject using the Options API

I've been trying to follow the documentation for the API on the Vue 3 website which says to use app.provide('keyName',variable) inside your main.js file like so: import App from './App.vue' import { createApp } from 'vue' import axios from…
Kris
  • 37
  • 5
1
vote
2 answers

How can I toggle visibility and scroll to a target section in one click in Vue.js?

When switching between sections I want to toggle between hide / show and scroll the target section into view. This code works but it takes two clicks instead of one to complete the process: first click toggles visibility and it takes a second click…
user1837293
  • 1,466
  • 3
  • 16
  • 30
1
vote
1 answer

Vue3 shared props between components

I've recently switched from Vue2 to Vue3 but I'm sort of confused to what the best practice is to shared props between multiple components. I want to make input components which share the common props like "type", "name", etc. Previously I did it…
1
vote
2 answers

VueJs 3 - Reactive Render Function using Script Setup and Composition API

I have a component called x-input that works as following: This works fine and it is reactive. How do I create the same functionality using a render…
lfmunoz
  • 822
  • 1
  • 9
  • 16
1
vote
1 answer

Can you use Pinia in Composition API's