I used inpu to make a switch button binding that starts with the off state, that is, isOpen is false,.
then call the getAutoInvestInfo method in created to request data every time you enter the component. If the returned status is 1, the switch is turned on, that is, isOpen becomes true
. Now there is a problem that the switch is turned off by default every time you enter the component, and it may be due to the delay caused by the time it takes to adjust the interface to get the data, that is, the switch is displayed as soon as you enter the component. The thing is, after a very short period of time, the closed state becomes on
, which doesn"t feel good, although it is closed by default, but I think if the returned status is 1 Q, what I see directly is that I don"t want to see the closed state become open state. Is there a way to solve this?
HTML Code
< input type= "checkbox" v Modele = "isOpen" id= "switchAutoInvest" class= "regular-checkbox big-checkbox" / >
< label for= "switchAutoInvest" id= "label" > < / label >
created
this.getAutoInvestInfo ()
after the data is requested
if (data.status = = 1) {/ / enabled
this.isOpen = true
}
if you can"t upload the picture, you won"t send the picture