1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import _toConsumableArray from 'babel-runtime/helpers/toConsumableArray';
import PropTypes from '../_util/vue-types';
import { initDefaultProps } from '../_util/props-util';
var widthUnit = PropTypes.oneOfType([PropTypes.number, PropTypes.string]);
var skeletonParagraphProps = {
prefixCls: PropTypes.string,
width: PropTypes.oneOfType([widthUnit, PropTypes.arrayOf(widthUnit)]),
rows: PropTypes.number
};
export var SkeletonParagraphProps = PropTypes.shape(skeletonParagraphProps);
var Paragraph = {
props: initDefaultProps(skeletonParagraphProps, {
prefixCls: 'ant-skeleton-paragraph'
}),
methods: {
getWidth: function getWidth(index) {
var width = this.width,
_rows = this.rows,
rows = _rows === undefined ? 2 : _rows;
if (Array.isArray(width)) {
return width[index];
}
// last paragraph
if (rows - 1 === index) {
return width;
}
return undefined;
}
},
render: function render() {
var _this = this;
var h = arguments[0];
var _$props = this.$props,
prefixCls = _$props.prefixCls,
rows = _$props.rows;
var rowList = [].concat(_toConsumableArray(Array(rows))).map(function (_, index) {
var width = _this.getWidth(index);
return h('li', { key: index, style: { width: typeof width === 'number' ? width + 'px' : width } });
});
return h(
'ul',
{ 'class': prefixCls },
[rowList]
);
}
};
export default Paragraph;