chore(Skeleton): use tsx

This commit is contained in:
chenjiahan 2020-10-10 19:04:38 +08:00
parent 5370eaafce
commit 6341967482
2 changed files with 8 additions and 5 deletions

View File

@ -66,4 +66,4 @@ export default {
| round `v2.8.5` | 是否将标题和段落显示为圆角风格 | _boolean_ | `false` |
| title-width | 标题占位图宽度 | _number \| string_ | `40%` |
| avatar-size | 头像占位图大小 | _number \| string_ | `32px` |
| avatar-shape | 头像占位图形状,可选值为`square` | _string_ | `round` |
| avatar-shape | 头像占位图形状,可选值为 `square` | _string_ | `round` |

View File

@ -1,3 +1,4 @@
import { PropType } from 'vue';
import { createNamespace, addUnit, getSizeStyle } from '../utils';
const [createComponent, bem] = createNamespace('skeleton');
@ -26,7 +27,7 @@ export default createComponent({
default: '32px',
},
avatarShape: {
type: String,
type: String as PropType<'square' | 'round'>,
default: 'round',
},
titleWidth: {
@ -34,7 +35,9 @@ export default createComponent({
default: '40%',
},
rowWidth: {
type: [Number, String, Array],
type: [Number, String, Array] as PropType<
number | string | (number | string)[]
>,
default: DEFAULT_ROW_WIDTH,
},
},
@ -62,7 +65,7 @@ export default createComponent({
}
};
const getRowWidth = (index) => {
const getRowWidth = (index: number) => {
const { rowWidth } = props;
if (rowWidth === DEFAULT_ROW_WIDTH && index === +props.row - 1) {
@ -77,7 +80,7 @@ export default createComponent({
};
const renderRows = () => {
const Rows = [];
const Rows: JSX.Element[] = [];
for (let i = 0; i < props.row; i++) {
Rows.push(