import Vue , { VueConstructor , Component , VNodeData , AsyncComponent , ComponentOptions } from 'vue' ; import { RootComponent , InputComponent } from './interface' ; param { String } 错误描述 export function throwError ( message ) { throw ( `__PKG_NAME__: ${ message }` ) ; } ; param { ComponentOptions < Vue > } 支持的组件格式 export function getComponentPlainObject ( component ) { return component as ComponentOptions < Vue > ; } param { String | String [ ] } 组件name字段或as字段 param { String } 前缀 returns { scope export function parseAlias ( name = '' , prefix ) { let method = '' ; let scope ; if ( undefined === name || '' === name ) { throwError ( `请用as给这个命令起个别名!` ) ; } else if ( 'string' === typeof name ) { method = prefix + name ; } else if ( Array === name . constructor ) { if ( 1 < name . length ) { scope = prefix + name [ 0 ] ; method = name [ 1 ] ; } else { method = prefix + name [ 0 ] ; } } return { scope , method , UNIQUE_PATH : undefined === scope ? method : [ scope , method ] . join ( '.' ) } ; } /**
 * 获取快捷方式属性名
 */ export function getMatchProp ( defaultProp , globalDefautProps , component ) { if ( undefined !== ( < any > component . props ) [ defaultProp ] ) { return defaultProp ; } else { for ( let propKey of globalDefautProps ) { if ( undefined !== ( < any > component . props ) [ propKey ] ) { return propKey ; } } } } param { Any } 输入 returns { Boolean } export function isObject ( input ) { return Object === input . constructor ; } export function mergeVNodeData ( oldData , newData ) { if ( undefined !== oldData ) { let key ; for ( key in newData ) { oldData [ key ] = { ... oldData [ key ] , ... newData [ key ] } ; } } return oldData || { } ; }