欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

error ‘res‘ is assigned a value but never used no-unused-vars

程序员文章站 2022-03-21 11:37:26
我们在写代码的时候有时候会遇到这样的错误:明明什么都对还是会报错,错误如下:error ‘res’ is assigned a value but never used no-unused-vars ERROR Failed to compile with 1 errors 1:56:25 ├F10: PM┤ error in ./src/views/Category...

我们在写代码的时候有时候会遇到这样的错误:明明什么都对还是会报错,错误如下:
error ‘res’ is assigned a value but never used no-unused-vars

 ERROR  Failed to compile with 1 errors                                                                1:56:25 ├F10: PM┤

 error  in ./src/views/CategoryEdit.vue

Module Error (from ./node_modules/eslint-loader/index.js):

C:\Users\Administrator\Desktop\学习\task\admin\src\views\CategoryEdit.vue
  24:19  error  'res' is assigned a value but never used  no-unused-vars

✖ 1 problem (1 error, 0 warnings)

错误原因是 eslint 的验证语法
解决办法:只需在错误语句后面加注释:// eslint-disable-line no-unused-vars 即可
代码如下:

async save() {
            const res = await this.$http.post('categories', this.model); // eslint-disable-line no-unused-vars
            })
        }

本文地址:https://blog.csdn.net/weixin_43918847/article/details/111034102