ESlint全局变量报错


场景:

在main.js下申明了全局变量:

/* eslint no-undef: "error" */
window.vm = new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})

 

在fetch的index.js中用element的message组件,出现ESlint报错

          vm.$message({
            message: response.msg,
            type: 'warning'
          })

 

解决方案:

是的,没错,加了

/* global vm */

就不会报错了

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM