ESLint配置相关报错解决办法

133 阅读1分钟

报错1:Vue:Do not use 'new' for side effects报错解决

报错代码

new Vue({
      el: '#post-demo',
      data: {
        posts: [
          { id: 1, title: 'My journey with Vue' },
          { id: 2, title: 'Blogging with Vue' },
          { id: 3, title: 'Why Vue is so fun' }
        ]
      }
    })

修改后代码

let vue = new Vue({
      el: '#post-demo',
      data: {
        posts: [
          { id: 1, title: 'My journey with Vue' },
          { id: 2, title: 'Blogging with Vue' },
          { id: 3, title: 'Why Vue is so fun' }
        ]
      }
    })
 
 
Vue.use({
  vm
})

或者直接在本段代码上面添加注释**/*eslint-disable no-new*/**