@@ -4,7 +4,7 @@ import props from './props';
44import { SkeletonRowColObj } from './type' ;
55import { ClassName , Styles } from '../common/common' ;
66import { classNames } from '../common/utils' ;
7- import { isNumber } from '../common/validator' ;
7+ import { isInteger , isNumeric , isPlainObject } from '../common/validator' ;
88
99const { prefix } = config ;
1010const name = `${ prefix } -skeleton` ;
@@ -68,12 +68,13 @@ export default class Skeleton extends SuperComponent {
6868 }
6969
7070 const parsedRowCols = rowCols . map ( ( item ) => {
71- if ( isNumber ( item ) ) {
71+ if ( isInteger ( item ) && item > 0 ) {
7272 return new Array ( item ) . fill ( {
7373 class : this . getColItemClass ( { type : 'text' } ) ,
7474 style : { } ,
7575 } ) ;
7676 }
77+
7778 if ( Array . isArray ( item ) ) {
7879 return item . map ( ( col ) => {
7980 return {
@@ -89,7 +90,7 @@ export default class Skeleton extends SuperComponent {
8990 {
9091 ...nItem ,
9192 class : this . getColItemClass ( nItem ) ,
92- style : this . getColItemStyle ( nItem ) ,
93+ style : isPlainObject ( nItem ) ? this . getColItemStyle ( nItem ) : { } ,
9394 } ,
9495 ] ;
9596 } ) ;
@@ -122,7 +123,7 @@ export default class Skeleton extends SuperComponent {
122123 const style : Styles = { } ;
123124 styleName . forEach ( ( name ) => {
124125 if ( name in obj ) {
125- const px = isNumber ( obj [ name ] ) ? `${ obj [ name ] } px` : obj [ name ] ;
126+ const px = isNumeric ( obj [ name ] ) ? `${ obj [ name ] } px` : obj [ name ] ;
126127 if ( name === 'size' ) {
127128 [ style . width , style . height ] = [ px , px ] ;
128129 } else {
0 commit comments