Skip to content

Tag: vue.js

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…

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…

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 t…

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 ov…