1: throw new Error() 用法与 throw error 用法:
throw new Error(); 创建错误, 创建一个错误里类型抛出。
if (res && res.code) {
this.$Modal.success({
title: "提示",
content: "保存成功"
});
this.$emit("closeDialog", {
isShow: false,
isRefresh: true
});
} else {
throw new Error("保存失败,请稍后再试!");
}
自己手动创建一个错误。
throw error: 这个是抛出错误。