1
1
import VcTreeSelect , { TreeNode , SHOW_ALL , SHOW_PARENT , SHOW_CHILD } from '../vc-tree-select' ;
2
- import { inject } from 'vue' ;
2
+ import { App , defineComponent , inject } from 'vue' ;
3
3
import classNames from '../_util/classNames' ;
4
4
import { TreeSelectProps } from './interface' ;
5
5
import warning from '../_util/warning' ;
6
- import { initDefaultProps , getOptionProps , getComponent , getSlot } from '../_util/props-util' ;
6
+ import { getOptionProps , getComponent , getSlot } from '../_util/props-util' ;
7
+ import initDefaultProps from '../_util/props-util/initDefaultProps' ;
7
8
import { defaultConfigProvider } from '../config-provider' ;
8
9
9
10
export { TreeData , TreeSelectProps } from './interface' ;
@@ -14,7 +15,7 @@ import CloseOutlined from '@ant-design/icons-vue/CloseOutlined';
14
15
import CloseCircleOutlined from '@ant-design/icons-vue/CloseCircleOutlined' ;
15
16
import omit from 'omit.js' ;
16
17
17
- const TreeSelect = {
18
+ const TreeSelect = defineComponent ( {
18
19
TreeNode,
19
20
SHOW_ALL ,
20
21
SHOW_PARENT ,
@@ -28,6 +29,7 @@ const TreeSelect = {
28
29
} ) ,
29
30
setup ( ) {
30
31
return {
32
+ vcTreeSelect : null ,
31
33
configProvider : inject ( 'configProvider' , defaultConfigProvider ) ,
32
34
} ;
33
35
} ,
@@ -111,7 +113,7 @@ const TreeSelect = {
111
113
} ,
112
114
113
115
render ( ) {
114
- const props = getOptionProps ( this ) ;
116
+ const props : any = getOptionProps ( this ) ;
115
117
const {
116
118
prefixCls : customizePrefixCls ,
117
119
size,
@@ -121,10 +123,9 @@ const TreeSelect = {
121
123
...restProps
122
124
} = props ;
123
125
const { class : className } = this . $attrs ;
124
- const getPrefixCls = this . configProvider . getPrefixCls ;
126
+ const { renderEmpty , getPrefixCls } = this . configProvider ;
125
127
const prefixCls = getPrefixCls ( 'select' , customizePrefixCls ) ;
126
128
127
- const renderEmpty = this . configProvider . renderEmpty ;
128
129
const notFoundContent = getComponent ( this , 'notFoundContent' ) ;
129
130
const removeIcon = getComponent ( this , 'removeIcon' ) ;
130
131
const clearIcon = getComponent ( this , 'clearIcon' ) ;
@@ -145,7 +146,7 @@ const TreeSelect = {
145
146
const cls = {
146
147
[ `${ prefixCls } -lg` ] : size === 'large' ,
147
148
[ `${ prefixCls } -sm` ] : size === 'small' ,
148
- [ className ] : className ,
149
+ [ className as string ] : className ,
149
150
} ;
150
151
151
152
// showSearch: single - false, multiple - true
@@ -196,10 +197,10 @@ const TreeSelect = {
196
197
/>
197
198
) ;
198
199
} ,
199
- } ;
200
+ } ) ;
200
201
201
202
/* istanbul ignore next */
202
- TreeSelect . install = function ( app ) {
203
+ TreeSelect . install = function ( app : App ) {
203
204
app . component ( TreeSelect . name , TreeSelect ) ;
204
205
app . component ( 'ATreeSelectNode' , TreeSelect . TreeNode ) ;
205
206
return app ;
0 commit comments