1. 如果没有穿 Options 则在已有 components 中可能存在的同名组件
    2. 在开发环境中会对组件名称校验(大驼峰命名)
    3. 如果传入的第二参数是对象,则
      1. function (
      2. id: string,
      3. definition: Function | Object
      4. ): Function | Object | void {
      5. if (!definition) {
      6. return this.options[type + 's'][id]
      7. } else {
      8. /* istanbul ignore if */
      9. if (process.env.NODE_ENV !== 'production' && type === 'component') {
      10. validateComponentName(id)
      11. }
      12. if (type === 'component' && isPlainObject(definition)) {
      13. definition.name = definition.name || id
      14. definition = this.options._base.extend(definition)
      15. }
      16. if (type === 'directive' && typeof definition === 'function') {
      17. definition = { bind: definition, update: definition }
      18. }
      19. this.options[type + 's'][id] = definition
      20. return definition
      21. }
      22. }