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不報錯