首页 > 其他 > 详细

为什么vue创建不用class而是用函数

时间:2020-06-12 12:33:19      阅读:176      评论:0      收藏:0      [点我收藏+]

源码中vue入口

function Vue (options) {
    if (!(this instanceof Vue)
    ) {
      warn(‘Vue is a constructor and should be called with the `new` keyword‘);
    }
    this._init(options);
  }
它实际上就是?个? Function 实现的类,我们只能通过new Vue 去实例化它。
Vue 按功能把这些扩展分散到多个模块中去实现,?不是在?个模块?实现所有,这种?式是? Class 难以实现的。这么做的好处是?常?便代码的维护和管理

为什么vue创建不用class而是用函数

原文:https://www.cnblogs.com/TTblog5/p/13098541.html

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