- 如果没有穿 Options 则在已有 components 中可能存在的同名组件
- 在开发环境中会对组件名称校验(大驼峰命名)
- 如果传入的第二参数是对象,则
function (id: string,definition: Function | Object): Function | Object | void {if (!definition) {return this.options[type + 's'][id]} else {/* istanbul ignore if */if (process.env.NODE_ENV !== 'production' && type === 'component') {validateComponentName(id)}if (type === 'component' && isPlainObject(definition)) {definition.name = definition.name || iddefinition = this.options._base.extend(definition)}if (type === 'directive' && typeof definition === 'function') {definition = { bind: definition, update: definition }}this.options[type + 's'][id] = definitionreturn definition}}
