In my code, I am using a v-if
statement to display an error message in HTML.
<div id="error" v-if="showError">Error User or Password</div>
data() {
return {
showError: false,
};}
When I change the value of showError
to true
in the data object, the error message is displayed as expected.
However, when I try to trigger the error message inside the catch
block:
catch (error) {
alert('Invalid username or password')
}
The alert
function works correctly, but setting showError = true
or showError: true;
does not display the error message in HTML as expected.
Any suggestions on how to achieve this functionality?