All good day to you!
I am having trouble pushing items with an index to an object. I have a blank object just as below:
let data {};
I want to push items to the data object as follows:
// expected array
data = {
1000: ['a', 'b'],
1001: ['x', 'y']
};
To achieve that what I tried is:
this.$set(data, 1000, ['a', 'b']);
this.$set(data, 1001, ['x', 'y']);
I also tried out:
data[1000] = ['a', 'b'];
data[1001] = ['x', 'y'];
The real problem I am facing is I am getting lots of empty values within the array like this:
If I print that data object in the HTML then I get something like this:
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, ...... ]
Since I have a large index value and I am getting a large number of empty values within an array which is slowing down the application and it takes a long time to render in HTML. Can someone help me out here to overcome this issue, please? Thank you in advance!
