Vue常见问题解决办法(一)ESLint检查报错


vue.js报错“Do not use 'new' for side effects“(main.js里)解决办法

ESLint工具检查代码质量,main.js里的原代码是这样的:

new Vue({

router,

el: "#app",

template: '<App/>',

components: { App }

})

这段代码不使用ESLint检查运行是没有问题的,使用了ESLint要改成如下的形式:

 let vm = new Vue({
el: '#app',
router,
template: '<App/>',
components: { App }
});
Vue.use(vm);

ESLint不报错


免责声明!

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



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