[Vuejs]-Vue, basing link in href off of the method completing first

0👍

You need programmatic navigation (vue router if you want) and async/await:

You could do it without the router in vanilla js as well:

methods: {
  async changeStatus(dateEvent) {
    await this.myAsyncFunction(); // your function that takes two seconds to complete
    let data = {
        id: dateEvent.task_id,
        status: 'P'
    };
    var route = '/task/' + dateEvent.task_id + '/progress'"
    this.$router.push(route);
  }
}
<button @click="changeStatus(dateEvent)" type="button" class=" taskButton btn-default">
    <a style="color:white;">Accept Task</a>
</button>

Leave a comment