|
| 1 | +import { inject } from 'vue'; |
1 | 2 | import classNames from 'classnames';
|
2 | 3 | import PropTypes from '../_util/vue-types';
|
3 | 4 | import { initDefaultProps, hasProp } from '../_util/props-util';
|
4 | 5 | import { ConfigConsumerProps } from '../config-provider';
|
5 | 6 | import Avatar, { SkeletonAvatarProps } from './Avatar';
|
6 | 7 | import Title, { SkeletonTitleProps } from './Title';
|
7 | 8 | import Paragraph, { SkeletonParagraphProps } from './Paragraph';
|
8 |
| -import Base from '../base'; |
9 | 9 |
|
10 | 10 | export const SkeletonProps = {
|
11 | 11 | active: PropTypes.bool,
|
@@ -69,8 +69,10 @@ const Skeleton = {
|
69 | 69 | title: true,
|
70 | 70 | paragraph: true,
|
71 | 71 | }),
|
72 |
| - inject: { |
73 |
| - configProvider: { default: () => ConfigConsumerProps }, |
| 72 | + setup() { |
| 73 | + return { |
| 74 | + configProvider: inject('configProvider', ConfigConsumerProps), |
| 75 | + }; |
74 | 76 | },
|
75 | 77 | render() {
|
76 | 78 | const {
|
@@ -157,13 +159,12 @@ const Skeleton = {
|
157 | 159 | </div>
|
158 | 160 | );
|
159 | 161 | }
|
160 |
| - const children = this.$slots.default; |
| 162 | + const children = this.$slots.default && this.$slots.default(); |
161 | 163 | return children && children.length === 1 ? children[0] : <span>{children}</span>;
|
162 | 164 | },
|
163 | 165 | };
|
164 | 166 | /* 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); |
168 | 169 | };
|
169 | 170 | export default Skeleton;
|
0 commit comments