Delay of two-way data binding in vue input

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

.
Mar.01,2021

in this case, your request is placed in the beforeRouteEnter hook to get the data before entering the route.


add a loading effect. After obtaining the data, remove the loading effect


maybe this operation is asynchronous. Change it to Synchronize's try


you can set a false, to be added to the root element by default. When the function in created gets the result, set flag to true, and display all the contents.

Menu