try { this.submit_data.forEach((item) => { for (const key in item) { if (key === "lyName" || key === "ltId" || key === "ltName") { delete item[key]; } else if (!item.pcPrice) { throw new Error("请输入价格"); } else if (!item.lyAmount) { throw new Error("请输入数量"); } } }); } catch (e) { console.log(e); this.$message({ message: e.message, type: "error", }); return; }
标签:try,item,key,catch,new,message From: https://www.cnblogs.com/AKJERRT/p/16818257.html