编写vue项目时遇到了这样的错误报告
错误原因:eslint的验证语法
解决办法:在错误语句后添加注释
// eslint-disable-line no-unused-vars
如下列代码
methods: {
async save() {
let res; // eslint-disable-line no-unused-vars
if (this.id) {
res = await this.$http.put(`categories/${this.id}`, this.model);
} else {
res = await this.$http.post("categories", this.model);
}
this.$router.push("/categories/list");
this.$message({
type: "success",
message: "保存成功",
});
},
async fetch() {
const res = await this.$http.get(`categories/${this.id}`);
this.model = res.data;
},
},
之后就没问题了