@@ -7,7 +7,8 @@ import EyeInvisibleOutlined from '@ant-design/icons-vue/EyeInvisibleOutlined';
7
7
import inputProps from './inputProps' ;
8
8
import PropTypes from '../_util/vue-types' ;
9
9
import BaseMixin from '../_util/BaseMixin' ;
10
- import { defineComponent } from 'vue' ;
10
+ import { defineComponent , inject } from 'vue' ;
11
+ import { defaultConfigProvider } from '../config-provider' ;
11
12
12
13
const ActionMap = {
13
14
click : 'onClick' ,
@@ -20,8 +21,8 @@ export default defineComponent({
20
21
inheritAttrs : false ,
21
22
props : {
22
23
...inputProps ,
23
- prefixCls : PropTypes . string . def ( 'ant-input-password' ) ,
24
- inputPrefixCls : PropTypes . string . def ( 'ant-input' ) ,
24
+ prefixCls : PropTypes . string ,
25
+ inputPrefixCls : PropTypes . string ,
25
26
action : PropTypes . string . def ( 'click' ) ,
26
27
visibilityToggle : PropTypes . looseBool . def ( true ) ,
27
28
iconRender : PropTypes . func . def ( ( visible : boolean ) =>
@@ -31,6 +32,7 @@ export default defineComponent({
31
32
setup ( ) {
32
33
return {
33
34
input : null ,
35
+ configProvider : inject ( 'configProvider' , defaultConfigProvider ) ,
34
36
} ;
35
37
} ,
36
38
data ( ) {
@@ -56,8 +58,8 @@ export default defineComponent({
56
58
visible : ! this . visible ,
57
59
} ) ;
58
60
} ,
59
- getIcon ( ) {
60
- const { prefixCls , action } = this . $props ;
61
+ getIcon ( prefixCls ) {
62
+ const { action } = this . $props ;
61
63
const iconTrigger = ActionMap [ action ] || '' ;
62
64
const iconRender = this . $slots . iconRender || this . $props . iconRender ;
63
65
const icon = iconRender ( this . visible ) ;
@@ -81,8 +83,8 @@ export default defineComponent({
81
83
} ,
82
84
render ( ) {
83
85
const {
84
- prefixCls,
85
- inputPrefixCls,
86
+ prefixCls : customizePrefixCls ,
87
+ inputPrefixCls : customizeInputPrefixCls ,
86
88
size,
87
89
suffix,
88
90
action,
@@ -91,7 +93,12 @@ export default defineComponent({
91
93
...restProps
92
94
} = getOptionProps ( this ) ;
93
95
const { class : className } = this . $attrs ;
94
- const suffixIcon = visibilityToggle && this . getIcon ( ) ;
96
+
97
+ const getPrefixCls = this . configProvider . getPrefixCls ;
98
+ const inputPrefixCls = getPrefixCls ( 'input' , customizeInputPrefixCls ) ;
99
+ const prefixCls = getPrefixCls ( 'input-password' , customizePrefixCls ) ;
100
+
101
+ const suffixIcon = visibilityToggle && this . getIcon ( prefixCls ) ;
95
102
const inputClassName = classNames ( prefixCls , className , {
96
103
[ `${ prefixCls } -${ size } ` ] : ! ! size ,
97
104
} ) ;
0 commit comments