Skip to content
Advertisement

Tag: vue.js

Vuelidate: setting $model does not update component

Given the following Vue component that uses Vuetify and Vuelidate: I would like to programmatically change the value of this.picker. I tried both changing the v-model as well as the Vuelidate $model: and Neither of them caused a change in the UI nor produced an error message. How can I programmatically update the DatePicker’s value? Answer Try just assigning v-model

catch and handle connection refused error using Axios

I use Axios for my VueJs app and have a Express REST Api. When my VueJs app is not able to call the backend (connection refused / the node server is not running) How can I catch this error? I tried to log the error using an interceptor but when logging the err I only get Error: Network Error with

$emit executes before computed

I’m trying to emit a prop that I modify. I can do that directly with the prop and it works but I get a Vue Warn: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders So I tried to put the prop in a computed, but the emit executes before the computed is

Vuejs – Update Object in an Array

I am using VueJs and I have an array of objects. What i want to do is update an object in the array based on its index. For that I’ve written a method: However, the object just doesn’t update. I’ve created the following jsbin for it. https://jsbin.com/boturuluxe/1/edit?html,js,console,output Any help is appreciated. Answer Due to limitations in JavaScript, Vue cannot detect

Vue How to Merge Two Arrays From Same Object?

I am pulling data from an API that gives me an object of items, each containing a string named correct_answer and an array named incorrect_answers. I am trying to combine those values within each item, so when I do v-for, it will loop through the answers merged together in one loop. I also want to randomize the order of those

Iterating over keys instead of values Vue app

I’m trying to select the values for three keys from my api with axios. Each time I make a request I’m displaying the values four times for each key. I dropped a key from my data models and I re tested. When I did that my request displayed three times instead of four. Meaning I’m iterating over the keys instead

How in Vue choose random name from from an array of names?

In “data” There is an array of Names: [‘Bogdan’, ‘Ruslan’ …]. How to make a random name get selected from the Names array and inserted into the <p> Names </ p> tag? I tried to do it like this — <p>{{Names[Math.floor(Math.random() * Names.length)]}}</p> but for some reason it does not work Answer You are not returning Names in your data

Advertisement