@@ -5,6 +5,7 @@ import Icon from '../icon';
5
5
import inputProps from './inputProps' ;
6
6
import PropTypes from '../_util/vue-types' ;
7
7
import BaseMixin from '../_util/BaseMixin' ;
8
+ import { ConfigConsumerProps } from '../config-provider/configConsumerProps' ;
8
9
9
10
const ActionMap = {
10
11
click : 'click' ,
@@ -21,11 +22,14 @@ export default {
21
22
} ,
22
23
props : {
23
24
...inputProps ,
24
- prefixCls : PropTypes . string . def ( 'ant-input-password' ) ,
25
- inputPrefixCls : PropTypes . string . def ( 'ant-input' ) ,
25
+ prefixCls : PropTypes . string ,
26
+ inputPrefixCls : PropTypes . string ,
26
27
action : PropTypes . string . def ( 'click' ) ,
27
28
visibilityToggle : PropTypes . bool . def ( true ) ,
28
29
} ,
30
+ inject : {
31
+ configProvider : { default : ( ) => ConfigConsumerProps } ,
32
+ } ,
29
33
data ( ) {
30
34
return {
31
35
visible : false ,
@@ -46,8 +50,8 @@ export default {
46
50
visible : ! this . visible ,
47
51
} ) ;
48
52
} ,
49
- getIcon ( ) {
50
- const { prefixCls , action } = this . $props ;
53
+ getIcon ( prefixCls ) {
54
+ const { action } = this . $props ;
51
55
const iconTrigger = ActionMap [ action ] || '' ;
52
56
const iconProps = {
53
57
props : {
@@ -74,14 +78,19 @@ export default {
74
78
} ,
75
79
render ( ) {
76
80
const {
77
- prefixCls,
78
- inputPrefixCls,
81
+ prefixCls : customizePrefixCls ,
82
+ inputPrefixCls : customizeInputPrefixCls ,
79
83
size,
80
84
suffix,
81
85
visibilityToggle,
82
86
...restProps
83
87
} = getOptionProps ( this ) ;
84
- const suffixIcon = visibilityToggle && this . getIcon ( ) ;
88
+
89
+ const getPrefixCls = this . configProvider . getPrefixCls ;
90
+ const inputPrefixCls = getPrefixCls ( 'input' , customizeInputPrefixCls ) ;
91
+ const prefixCls = getPrefixCls ( 'input-password' , customizePrefixCls ) ;
92
+
93
+ const suffixIcon = visibilityToggle && this . getIcon ( prefixCls ) ;
85
94
const inputClassName = classNames ( prefixCls , {
86
95
[ `${ prefixCls } -${ size } ` ] : ! ! size ,
87
96
} ) ;
0 commit comments