参考文章:https://vuejs.org/v2/guide/instance.html
一、Constructor构造函数
每一个 Vue应用是由带有一个构造函数Vue建立一个root Vue 实例,建立实例后,就开始启动一个应用。
|
尽管没有严格按照 MVVM pattern, Vue’s 设计者部分的受它启发。像传统一样, 我们经常使用变量vm (short for ViewModel) 指向我们的 Vue instance.
Model–view–viewmodel (MVVM) is a software architectural pattern.
当你建立一个Vue instance,你需要传递一个options object,这个选项对象包含数据,模板, element to mount on, 方法, 生命周期callbacks, and more. The full list of options can be found in the API reference.
The Vue
构造函数能被继承去建立重用的许多组件构造函数can be extended to create reusable component constructors with pre-defined options: