Vue中:error ‘XXXXX‘ is not defined no-undef解决办法

报错内容:

× Client
  Compiled with some errors in 7.42s
√ Server
  Compiled successfully in 6.05s
 ERROR  Failed to compile with 1 errors                                                                               friendly-errors 17:33:15  
 ERROR  in ./pages/player/_vid.vue                                                                                friendly-errors 17:33:15  
Module Error (from ./node_modules/eslint-loader/index.js):                                                                                friendly-errors 17:33:15  
E:\java\JavaWorkSpace\OnlineEducation\WebReview\vue-front-1010\pages\player\_vid.vue
  28:9  error  'Aliplayer' is not defined  no-undef
✖ 1 problem (1 error, 0 warnings)

报错截图:

解决办法:

在使用vue的时候,使用一个全局变量,ESLint的语法会出现ESLint: 'Aliplayer' is not defined. (no-undef),说变量未定义,这时我们可以添加配置,取消这个校验。在.eslintrc.js文件中添加一个配置,位置如下图所示,我的全局变量就是Aliplayer。

在eslintrc.js中的module.exports内添加如下代码块:

  "globals":{
    "Aliplayer": true
  }

位置如下:

module.exports = {
  root: true,
  parserOptions: {
  xxxxxx
  },
  env: {
  xxxxxx
  },
  rules: {
  xxxxxx
  },
  "globals":{
    "Aliplayer": true
  }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值