2👍
✅
You are being bitten by the array caveats. Instead of assigning individual array elements (using =
), use vm.$set
:
getColumnWidths() {
const _that = this;
this.header.forEach(function(element, index) {
_that.$set(_that.headerWidths, index, _that.$refs['head' + index][0].clientWidth)
});
console.log(this.headerWidths);
},
Source:stackexchange.com