How can I refactor this code snippet?

yeahch

ch

Posted on September 19, 2020

How can I refactor this code snippet?

While developing vuejs project, I often meet a situation like the following:
Here "this" is the vue component.
I would love to refactor this code to look it very nice.
Please share your idea with me.
Thank you.

const newReportPart = {
        id: this.id,
        title: this.title,
        description: this.description,
        product_id: this.product_id,
        product_title: this.product_title,
        rate: this.rate,
        saved: this.saved,
        attachments: this.attachments,
      };
      this.$emit('submitReportPart', this.index, newReportPart);
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
yeahch
ch

Posted on September 19, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related