1
+ import { inject , cloneVNode } from 'vue' ;
1
2
import debounce from 'lodash/debounce' ;
2
3
import PropTypes from '../_util/vue-types' ;
3
4
import BaseMixin from '../_util/BaseMixin' ;
4
5
import {
5
6
filterEmpty ,
6
7
initDefaultProps ,
7
8
isValidElement ,
8
- getComponentFromProp ,
9
+ getComponent ,
9
10
getListeners ,
10
11
} from '../_util/props-util' ;
11
- import { cloneElement } from '../_util/vnode' ;
12
12
import { ConfigConsumerProps } from '../config-provider' ;
13
13
14
14
export const SpinSize = PropTypes . oneOf ( [ 'small' , 'default' , 'large' ] ) ;
@@ -47,8 +47,10 @@ export default {
47
47
spinning : true ,
48
48
wrapperClassName : '' ,
49
49
} ) ,
50
- inject : {
51
- configProvider : { default : ( ) => ConfigConsumerProps } ,
50
+ setup ( ) {
51
+ return {
52
+ configProvider : inject ( 'configProvider' , ConfigConsumerProps ) ,
53
+ } ;
52
54
} ,
53
55
data ( ) {
54
56
const { spinning, delay } = this ;
@@ -100,7 +102,7 @@ export default {
100
102
renderIndicator ( h , prefixCls ) {
101
103
// const h = this.$createElement
102
104
const dotClassName = `${ prefixCls } -dot` ;
103
- let indicator = getComponentFromProp ( this , 'indicator' ) ;
105
+ let indicator = getComponent ( this , 'indicator' ) ;
104
106
// should not be render default indicator when indicator value is null
105
107
if ( indicator === null ) {
106
108
return null ;
@@ -110,11 +112,11 @@ export default {
110
112
indicator = indicator . length === 1 ? indicator [ 0 ] : indicator ;
111
113
}
112
114
if ( isValidElement ( indicator ) ) {
113
- return cloneElement ( indicator , { class : dotClassName } ) ;
115
+ return cloneVNode ( indicator , { class : dotClassName } ) ;
114
116
}
115
117
116
118
if ( defaultIndicator && isValidElement ( defaultIndicator ( h ) ) ) {
117
- return cloneElement ( defaultIndicator ( h ) , { class : dotClassName } ) ;
119
+ return cloneVNode ( defaultIndicator ( h ) , { class : dotClassName } ) ;
118
120
}
119
121
120
122
return (
0 commit comments