21天完美搞定Vue框架技术(第1天)
1、Vue本质上是一个构造函数,只能通过new调用 function Vue ( options ) { // 保证了无法直接通过Vue()去调用,只能通过new的方式去创建实例 if ( ! ( this instanceof Vue ) ) { warn ( 'Vue is a constructor and should be called with the `new` keyword' ) ; } this . _init ( options ) ; } return Vue ; 2、Vue有5个原型属性和方法 init方法(内部方法):initMixin(Vue) 数据相关:stateMixin(Vue) 事件相关:eventsMixin(Vue) 生命周期相关:lifecycleMixin(Vue) 渲染相关:renderMixin(Vue) 3、Vue的静态属性和方法 配置方法:Vue.config() 内部工具方法:Vue.util() Vue.set() Vue.delet() Vue.nextTick() Vue.use() Vue.mixin() 扩展子类构造器:Vue.extend() 默认选项:Vue.components,Vue.directive,Vue.filter 4、Vue构造器的默认选项 Vue默认选项会保留在静态的options属性上