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

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