1๐
โ
Try to filter the numbers before return
computed: {
total() {
return this.numbers.filter(({number}) => Boolean(number)).length;
},
},
0๐
you can use array filter to make new array with custom condition
computed: {
total() {
return this.numbers.filter(el => el.number != null).length;
},
},
Source:stackexchange.com