VueComponent
- 组件的本质:是一个构造函数 VueComponent,且不是程序员定义,是 Vue.extend 生成的
-
只需要写
<school/>
或<school></school>
,Vue 就在解析式执行:new VueComponent(options)
帮我们创建 school 组件的实例对象
- 注意:每次调用 Vue.extend ,返回的都是一个全新的 VueComponent
- 关于 this 指向:
- 组件配置中:data、methods、watch、computed 中,它们的 this 均是 VueComponent实例对象
- new Vue(options):data、methods、watch、computed 中,它们的 this 均是 Vue实例对象