I'm trying to update my component with one button instead of two but I can't figure out how to do it
I have these buttons on my Main component
<button @click="subnetp" type="button" class="btn btn-dark">Subnet</button>
<button @click="clear" type="button" class="btn btn-dark">Clear</button>
they call these methods
subnetp: function(){
if(this.itsIp(this.ip.dec) && this.itsPrefix(this.ip.dec)){
this.separete();
this.showSubnet = true;
this.isReverse = false
}
},
clear: function(){
this.showSubnet = false;
this.isReverse = true;
}
When Subnet button is clicked it will show the next component and send some variables as props
<subnet-app v-if="showSubnet" v-bind:ip='ip,host'></subnet-app>
If I change the info in the component with the buttons I have to click the clear button first and then click subnet to see the component with the info updated.
I want to do this with only one button, but if I try something like this and call the method of clear in the subnet method the button won't work and I still have to click clear first
subnetp: function(){
this.clear();
if(this.itsIp(this.ip.dec) && this.itsPrefix(this.ip.dec)){
this.separete();
this.showSubnet = true;
this.isReverse = false
}
}