I have the following code within my component:
computed: {
gridWidth() { return (this.$el && this.$el.offsetWidth) },
gridHeight() { return (this.$el && this.$el.offsetHeight) },
},
mounted(){
console.log(this.$el && this.$el.offsetWidth, this.gridWidth, this.$el && this.$el.offsetHeight, this.gridHeight)
},
The console output is:
1766 undefined 931 undefined
Why are the computed properties undefined?
Would be a watcher the right way? Why and how to realize?