Answer the question
In order to leave comments, you need to log in
How to execute a function only when the checkbox is set to true?
Good day everyone!
Prompt how to implement switching between two functions.
I have two plugins d3 and Snap.svg, how to make it so that when the checkbox is enabled, d3 is executed and when snap.svg is disabled.
svg: function (){
this.d3()
this.svgSnap()
}
Answer the question
In order to leave comments, you need to log in
create a variable in data:
Put v-model on the checkbox
and use it in the method
svg: function (){
if(this.isD3JS){
this.d3()
}else{
this.svgSnap()
}
}
if(document.getElementById("someElement").checked){
// Очевидно, что если проставлен
}else{
// Очевидно, что если не проставлен
}
Make two child components, one with d3, one with svgsnap, drive them to a variable and v-if v-else
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question