I have a polygonCrop component which one of them has a ref with canvas property, I am using each component in separate crop functions on two button components so I would like to know how to use multiple refs with multiple components in Vue.js?
<polygonCrop
:canvasClass="'some-class'"
:height="600"
:imageSource="imgSrc"
:showCanvas="show"
:showPointer="showPointer"
:width="800"
ref="canvas"
></polygonCrop>
<polygonCrop
:canvasClass="'some-class'"
:height="600"
:imageSource="imgSrc1"
:showCanvas="show"
:showPointer="showPointer"
:width="800"
ref="canvas1"
></polygonCrop>
...
<b-button @click.prevent="crop" variant="success">Crop</b-button>
<b-button @click.prevent="crop1" variant="success">Crop</b-button>
...
crop: function () {
this.$refs.canvas.crop();
this.resultImage = this.$refs.canvas.resultImage;
this.show = false;
this.showResult = true;
},
crop1: function () {
this.$refs.canvas1.crop();
this.resultImage1 = this.$refs.canvas1.resultImage;
this.show = false;
this.showResult = true;
},
I am using multiple canvases like canvas and canvas1 but I want to know if this is the right way to do this?