0👍
✅
Use computed property instead of data
Instead of storing var canvas
inside data()
, I stored it inside computed:
. Therefore, I used the following code:
computed: {
canvas() {
return new fabric.Canvas("canvas", { isDrawingMode: true });
}
},
In methods:
I then used:
this.canvas.clear();
Source:stackexchange.com