Is there a way to ensure that a user can only trigger an onClick event and execute a function if a specific variable is set to true? Here's an example:
<button @click='hello'>Trigger</button>
data: function() {
return {
isAuthenticated: true
}
},
methods: {
hello(){
console.log('hello')
}
}
I want to clarify that I'm not looking to simply hide the button. I specifically want button clicks to be disabled unless isAuthenticated is true.