File tree Expand file tree Collapse file tree 6 files changed +49
-16
lines changed Expand file tree Collapse file tree 6 files changed +49
-16
lines changed Original file line number Diff line number Diff line change 1
1
module . exports = {
2
2
dev : {
3
- componentName : 'pagination ' , // dev components
3
+ componentName : 'popconfirm ' , // dev components
4
4
} ,
5
5
} ;
Original file line number Diff line number Diff line change @@ -72,4 +72,27 @@ describe('Popconfirm', () => {
72
72
expect ( popup . innerHTML ) . toMatchSnapshot ( ) ;
73
73
} , 1000 ) ;
74
74
} ) ;
75
+
76
+ it ( 'should not open in disabled' , async ( ) => {
77
+ const popconfirm = mount (
78
+ {
79
+ render ( ) {
80
+ return (
81
+ < Popconfirm ref = "popconfirm" title = "code" disabled >
82
+ < span > click me</ span >
83
+ </ Popconfirm >
84
+ ) ;
85
+ } ,
86
+ } ,
87
+ { sync : false } ,
88
+ ) ;
89
+
90
+ await asyncExpect ( ( ) => {
91
+ popconfirm . find ( 'span' ) . trigger ( 'click' ) ;
92
+ } , 1000 ) ;
93
+ await asyncExpect ( ( ) => {
94
+ const popup = popconfirm . vm . $refs . popconfirm . getPopupDomNode ( ) ;
95
+ expect ( popup ) . toBeFalsy ( ) ;
96
+ } , 1000 ) ;
97
+ } ) ;
75
98
} ) ;
Original file line number Diff line number Diff line change 1
1
## API
2
2
3
- | Param | Description | Type | Default value |
4
- | --- | --- | --- | --- |
5
- | cancelText | text of the Cancel button | string\| slot | ` Cancel ` |
6
- | okText | text of the Confirm button | string\| slot | ` Confirm ` |
7
- | okType | Button ` type ` of the Confirm button | string | ` primary ` |
8
- | title | title of the confirmation box | string\| slot | - |
9
- | icon | customize icon of confirmation | vNode\| slot | < ; Icon type="exclamation-circle" /> ; |
3
+ | Param | Description | Type | Default value | Version |
4
+ | --- | --- | --- | --- | --- |
5
+ | cancelText | text of the Cancel button | string\| slot | ` Cancel ` | |
6
+ | okText | text of the Confirm button | string\| slot | ` Confirm ` | |
7
+ | okType | Button ` type ` of the Confirm button | string | ` primary ` | |
8
+ | title | title of the confirmation box | string\| slot | - | |
9
+ | icon | customize icon of confirmation | vNode\| slot | < ; Icon type="exclamation-circle" /> ; | |
10
+ | disabled | is show popconfirm when click its childrenNode | boolean | false | 1.5.0 |
10
11
11
12
### events
12
13
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ const Popconfirm = {
24
24
title : PropTypes . any ,
25
25
trigger : tooltipProps . trigger . def ( 'click' ) ,
26
26
okType : btnProps . type . def ( 'primary' ) ,
27
+ disabled : PropTypes . bool . def ( false ) ,
27
28
okText : PropTypes . any ,
28
29
cancelText : PropTypes . any ,
29
30
icon : PropTypes . any ,
@@ -48,7 +49,8 @@ const Popconfirm = {
48
49
const state = { sVisible : false } ;
49
50
if ( 'visible' in props ) {
50
51
state . sVisible = props . visible ;
51
- } else if ( 'defaultVisible' in props ) {
52
+ }
53
+ if ( 'defaultVisible' in props ) {
52
54
state . sVisible = props . defaultVisible ;
53
55
}
54
56
return state ;
@@ -65,6 +67,10 @@ const Popconfirm = {
65
67
} ,
66
68
67
69
onVisibleChange ( sVisible ) {
70
+ const { disabled } = this . $props ;
71
+ if ( disabled ) {
72
+ return ;
73
+ }
68
74
this . setVisible ( sVisible ) ;
69
75
} ,
70
76
Original file line number Diff line number Diff line change 1
1
## API
2
2
3
- | 参数 | 说明 | 类型 | 默认值 |
4
- | ---------- | ------------------------ | ------------ | ---------------------------------------- |
5
- | cancelText | 取消按钮文字 | string\| slot | 取消 |
6
- | okText | 确认按钮文字 | string\| slot | 确定 |
7
- | okType | 确认按钮类型 | string | primary |
8
- | title | 确认框的描述 | string\| slot | 无 |
9
- | icon | 自定义弹出气泡 Icon 图标 | vNode | < ; Icon type="exclamation-circle" /> ; |
3
+ | 参数 | 说明 | 类型 | 默认值 | 版本 |
4
+ | --- | --- | --- | --- | --- |
5
+ | cancelText | 取消按钮文字 | string\| slot | 取消 | |
6
+ | okText | 确认按钮文字 | string\| slot | 确定 | |
7
+ | okType | 确认按钮类型 | string | primary | |
8
+ | title | 确认框的描述 | string\| slot | 无 | |
9
+ | icon | 自定义弹出气泡 Icon 图标 | vNode | < ; Icon type="exclamation-circle" /> ; | |
10
+ | disabled | 点击 Popconfirm 子元素是否弹出气泡确认框 | boolean | false | 1.5.0 |
10
11
11
12
### 事件
12
13
Original file line number Diff line number Diff line change @@ -38,4 +38,6 @@ export declare class Popconfirm extends TooltipCommon {
38
38
* @type any (VNode | slot)
39
39
*/
40
40
icon : any ;
41
+
42
+ disabled : boolean ;
41
43
}
You can’t perform that action at this time.
0 commit comments