Skip to content

Commit c1331cc

Browse files
authored
feat: update skeleton (#2371)
1 parent d591e4b commit c1331cc

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

components/skeleton/index.jsx

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import { inject } from 'vue';
12
import classNames from 'classnames';
23
import PropTypes from '../_util/vue-types';
34
import { initDefaultProps, hasProp } from '../_util/props-util';
45
import { ConfigConsumerProps } from '../config-provider';
56
import Avatar, { SkeletonAvatarProps } from './Avatar';
67
import Title, { SkeletonTitleProps } from './Title';
78
import Paragraph, { SkeletonParagraphProps } from './Paragraph';
8-
import Base from '../base';
99

1010
export const SkeletonProps = {
1111
active: PropTypes.bool,
@@ -69,8 +69,10 @@ const Skeleton = {
6969
title: true,
7070
paragraph: true,
7171
}),
72-
inject: {
73-
configProvider: { default: () => ConfigConsumerProps },
72+
setup() {
73+
return {
74+
configProvider: inject('configProvider', ConfigConsumerProps),
75+
};
7476
},
7577
render() {
7678
const {
@@ -157,13 +159,12 @@ const Skeleton = {
157159
</div>
158160
);
159161
}
160-
const children = this.$slots.default;
162+
const children = this.$slots.default && this.$slots.default();
161163
return children && children.length === 1 ? children[0] : <span>{children}</span>;
162164
},
163165
};
164166
/* istanbul ignore next */
165-
Skeleton.install = function(Vue) {
166-
Vue.use(Base);
167-
Vue.component(Skeleton.name, Skeleton);
167+
Skeleton.install = function(app) {
168+
app.component(Skeleton.name, Skeleton);
168169
};
169170
export default Skeleton;

examples/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import Anchor from 'ant-design-vue/anchor';
1212
import ConfigProvider from 'ant-design-vue/config-provider';
1313
import Result from 'ant-design-vue/result';
1414
import Spin from 'ant-design-vue/spin';
15+
import Skeleton from 'ant-design-vue/skeleton';
1516
import Empty from 'ant-design-vue/empty';
1617
import Timeline from 'ant-design-vue/timeline';
1718
import 'ant-design-vue/style.js';
@@ -27,6 +28,7 @@ createApp(App)
2728
.use(Divider)
2829
.use(Result)
2930
.use(Anchor)
31+
.use(Skeleton)
3032
.use(Spin)
3133
.use(Empty)
3234
.use(Timeline)

0 commit comments

Comments
 (0)