When the B component finishes loading, I send an "emit" event to the A component via EventBus.
And when event received from A component is "on", it changes the value of specific data to true.
The value is registered in computed and can only be used with "a tag" if the value is true.
But actually the value changes to true but the click event still returns "return false;"
How to make click event behave dynamically in VueJS?
B Component
...
this.$EventBus.$emit("Loading");
...
A Component
<template>
<a href="javascript:void(0)" @click="completed ? btnFinish : 'return false;'">Complete</a>
</template>
<script>
data() {
return {
loading: false,
}
},
mounted() {
this.$EventBus.$on('Loading', ()=>{
this.loading = true;
});
},
computed: {
completed() {
return this.loading
}
}
</script>
btnFinish?