首页 > 其他 > 详细

Do not use ‘new’ for side effects

时间:2018-06-09 14:22:35      阅读:200      评论:0      收藏:0      [点我收藏+]
new Vue({
  el: ‘#App‘,
  router,
  template: ‘<App/>‘,
  components: { App }
})

  

上面这样会报错

改成下面这样就好了

 

let vm = new Vue({
  router,
  el: ‘#app‘,
  render: h => h(App)
})

Vue.use({vm})

 

或者加一行注释

/* eslint-disable no-new */
new Vue({
  el: ‘#App‘,
  router,
  template: ‘<App/>‘,
  components: { App }
})

  

 

Do not use ‘new’ for side effects

原文:https://www.cnblogs.com/tabCtrlShift/p/9159213.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!