@@ -13,7 +13,7 @@ import {
13
13
import warning from '../_util/warning' ;
14
14
import LocaleReceiver from '../locale-provider/LocaleReceiver' ;
15
15
import { getTwoToneColor , setTwoToneColor } from './twoTonePrimaryColor' ;
16
- import { filterEmpty , getClass } from '../_util/props-util' ;
16
+ import { filterEmpty , getListeners } from '../_util/props-util' ;
17
17
import Base from '../base' ;
18
18
19
19
// Initial setting
@@ -23,7 +23,8 @@ const defaultTheme = 'outlined';
23
23
let dangerousTheme ;
24
24
25
25
function renderIcon ( h , locale , context ) {
26
- const { props, slots, listeners, data } = context ;
26
+ const { $props : props , $slots } = context ;
27
+ const listeners = getListeners ( context ) ;
27
28
const {
28
29
// affect inner <svg>...</svg>
29
30
type,
@@ -36,8 +37,7 @@ function renderIcon(h, locale, context) {
36
37
rotate,
37
38
tabIndex,
38
39
} = props ;
39
- const slotsMap = slots ( ) ;
40
- let children = filterEmpty ( slotsMap . default ) ;
40
+ let children = filterEmpty ( $slots . default ) ;
41
41
children = children . length === 0 ? undefined : children ;
42
42
warning (
43
43
Boolean ( type || Component || children ) ,
@@ -46,7 +46,6 @@ function renderIcon(h, locale, context) {
46
46
) ;
47
47
48
48
const classString = classNames ( {
49
- ...getClass ( context ) ,
50
49
[ `anticon` ] : true ,
51
50
[ `anticon-${ type } ` ] : ! ! type ,
52
51
} ) ;
@@ -131,24 +130,20 @@ function renderIcon(h, locale, context) {
131
130
if ( iconTabIndex === undefined && 'click' in listeners ) {
132
131
iconTabIndex = - 1 ;
133
132
}
134
- const { attrs, ...restDataProps } = data ;
135
133
// functional component not support nativeOn,https://github.com/vuejs/vue/issues/7526
136
134
const iProps = {
137
- ...restDataProps ,
138
135
attrs : {
139
- ...attrs ,
140
136
'aria-label' : type && `${ locale . icon } : ${ type } ` ,
141
137
tabIndex : iconTabIndex ,
142
138
} ,
143
- on : { ... listeners , ... data . nativeOn } ,
139
+ on : listeners ,
144
140
class : classString ,
145
141
staticClass : '' ,
146
142
} ;
147
143
return < i { ...iProps } > { renderInnerNode ( ) } </ i > ;
148
144
}
149
145
150
146
const Icon = {
151
- functional : true ,
152
147
name : 'AIcon' ,
153
148
props : {
154
149
tabIndex : PropTypes . number ,
@@ -161,11 +156,11 @@ const Icon = {
161
156
twoToneColor : PropTypes . string ,
162
157
role : PropTypes . string ,
163
158
} ,
164
- render ( h , context ) {
159
+ render ( h ) {
165
160
return (
166
161
< LocaleReceiver
167
162
componentName = "Icon"
168
- scopedSlots = { { default : locale => renderIcon ( h , locale , context ) } }
163
+ scopedSlots = { { default : locale => renderIcon ( h , locale , this ) } }
169
164
/>
170
165
) ;
171
166
} ,
0 commit comments