Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

141
Views
Issue with multiple custom events firing, second event not working in Vue

I am emitting two different custom events from child, and for some reason the second event doesn't work.

I have checked on the Vue console and both events are being fired, however, nothing happens for the second event. When I comment out the first one, the second works correctly, as if the first one was blocking the second one.

<child-component
 @upload="handleUpload"
 @uploading="mediaUploading"
/>

 methods: {
    handleUpload(response) { //doesn't work
      this.mediaLoading = false;
      console.log(this.mediaLoading);
    },

    mediaUploading() { //works
      this.mediaLoading = true;
    },
}

In child component

 this.$emit('uploading');
  try {
    data = await this.$api.get('/photo');
  } catch (e) {
    console.log(e)
  }
 this.$emit('upload', data);
       
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

i have pasted the code on my machine and both are working fine

parent

  <template>
  <child-component @upload="handleUpload" @uploading="mediaUploading" />
</template>

<script>
import childComponent from "./page4child.vue";
export default {
  components: {
    childComponent,
  },
  data() {
    return {
      mediaLoading: true,
    };
  },
  methods: {
    handleUpload(response) {
      //works
      this.mediaLoading = false;
      console.log(this.mediaLoading);
    },

    mediaUploading() {
      //works
      this.mediaLoading = true;
      console.log(this.mediaLoading);
    },
  },
};
</script>

Child

<template>
  <div>
    <button @click="trigger('item')">run</button>
  </div>
</template>

<script>
export default {
  methods: {
    async trigger(uploadedItem) {
      this.$emit("uploading");
      await new Promise((res) => {
        console.log("duck");
        res();
      });
      this.$emit("upload", uploadedItem);
    },
  },
};
</script>

enter image description here

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!