VueComponent

  1. 组件的本质:是一个构造函数 VueComponent,且不是程序员定义,是 Vue.extend 生成的

  1. 只需要写 <school/><school></school> ,Vue 就在解析式执行:new VueComponent(options)

    帮我们创建 school 组件的实例对象


  1. 注意:每次调用 Vue.extend ,返回的都是一个全新的 VueComponent

  1. 关于 this 指向
    • 组件配置中:data、methods、watch、computed 中,它们的 this 均是 VueComponent实例对象
    • new Vue(options):data、methods、watch、computed 中,它们的 this 均是 Vue实例对象


posted @ 2022-04-25 10:54  春暖花开鸟  阅读(304)  评论(0编辑  收藏  举报