Answer the question
In order to leave comments, you need to log in
How in Vue to wait for something to load and only after successful loading allow to hang a click handler?
I need to wait for the data to come from the server and only then allow the user to click. How to do it? The option to display the button first without a handler, and then with is not suitable
Answer the question
In order to leave comments, you need to log in
Here it is not necessary this nonsense with juggling handlers.
Let the button be inactive until there is no data:
At the same time, the user, instead of being perplexed about the absence of any reaction to his actions, will clearly see that clicking on the button is not something that is not necessary - it's pointless.
<button :disabled="!данные" @click="onClick">
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question