UNPKG

1.9 kBJavaScriptView Raw
1import { createVNode as _createVNode } from "vue";
2
3function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
5import { defineComponent } from 'vue';
6import classNames from '../_util/classNames';
7import PropTypes from '../_util/vue-types';
8import { tuple } from '../_util/type';
9import initDefaultProps from '../_util/props-util/initDefaultProps';
10var skeletonAvatarProps = {
11 prefixCls: PropTypes.string,
12 size: PropTypes.oneOfType([PropTypes.oneOf(tuple('large', 'small', 'default')), PropTypes.number]),
13 shape: PropTypes.oneOf(tuple('circle', 'square'))
14};
15export var SkeletonAvatarProps = PropTypes.shape(skeletonAvatarProps).loose;
16var Avatar = defineComponent({
17 props: initDefaultProps(skeletonAvatarProps, {
18 size: 'large'
19 }),
20 render: function render() {
21 var _classNames, _classNames2;
22
23 var _this$$props = this.$props,
24 prefixCls = _this$$props.prefixCls,
25 size = _this$$props.size,
26 shape = _this$$props.shape;
27 var sizeCls = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-lg"), size === 'large'), _defineProperty(_classNames, "".concat(prefixCls, "-sm"), size === 'small'), _classNames));
28 var shapeCls = classNames((_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefixCls, "-circle"), shape === 'circle'), _defineProperty(_classNames2, "".concat(prefixCls, "-square"), shape === 'square'), _classNames2));
29 var sizeStyle = typeof size === 'number' ? {
30 width: "".concat(size, "px"),
31 height: "".concat(size, "px"),
32 lineHeight: "".concat(size, "px")
33 } : {};
34 return _createVNode("span", {
35 "class": classNames(prefixCls, sizeCls, shapeCls),
36 "style": sizeStyle
37 }, null);
38 }
39});
40export default Avatar;
\No newline at end of file