How can I refactor this code snippet?
ch
Posted on September 19, 2020
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);
💖 💪 🙅 🚩
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.