X
X
xcuube2019-08-11 17:24:06
Vue.js
xcuube, 2019-08-11 17:24:06

How to add an empty array to vue via Vue.set?

Hello! There is such an array
this.response.order.ordersItemsInfo[id]
, I use VUE and I want to add another array to this array in ordersItemsInfo[id] and I do it like this:

this.response.order.ordersItemsInfo[id].ordersItemsPropertiesInfo = [];
var object = {
       nomenclaturePropertiesId: '',
       IditemPropertyArray: '',
       Number: null
};

Vue.set(this.response.order.ordersItemsInfo[id].ordersItemsPropertiesInfo, this.response.order.ordersItemsInfo[id].ordersItemsPropertiesInfo.length, object);

But the problem is that VUE doesn't see these changes, because reactivity only works with push, pop, splice, etc. methods.
The question is - how to do the same as in this line, only through Vue.set ?
this.response.order.ordersItemsInfo[id].ordersItemsPropertiesInfo = [];

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-08-11
@xcuube

Vue.set(this.response.order.ordersItemsInfo[id], 'ordersItemsPropertiesInfo', [])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question