commit Table component

commit Table component
This commit is contained in:
梁灏 2016-11-23 16:27:17 +08:00
parent d2e82cd7f6
commit 2cb8a6d93e
12 changed files with 334 additions and 0 deletions

View file

@ -75,4 +75,16 @@ export function getStyle (element, styleName) {
} catch(e) {
return element.style[styleName];
}
}
// firstUpperCase
function firstUpperCase(str) {
return str.toString()[0].toUpperCase() + str.toString().slice(1);
}
// Warn
export function warnProp(component, prop, correctType, wrongType) {
correctType = firstUpperCase(correctType);
wrongType = firstUpperCase(wrongType);
console.error(`[iView warn]: Invalid prop: type check failed for prop ${prop}. Expected ${correctType}, got ${wrongType}. (found in component: ${component})`);
}