[Vuejs]-Resize FabricJS canvas from VueJS child component

0👍

heightChange (height) {
    this.canvasHeight = height;
    this.canvas.setHeight = this.canvasHeight;
},
widthChange (width) {
    this.canvasWidth = width;
    this.canvas.setWidth = this.canvasWidth;
}

setHeight and setWidth are methods which accepts parameters.
So instead of assigning it as property, update it to use method syntax.

 this.canvas.setHeight(this.canvasHeight);
 this.canvas.setWidth(this.canvasWidth);

http://fabricjs.com/docs/fabric.Canvas.html#setWidth
http://fabricjs.com/docs/fabric.Canvas.html#setHeight

Codesandbox:
https://codesandbox.io/s/fabric-js-stackoverflow-problem-4g4x2

Leave a comment