Prechádzať zdrojové kódy

Cascader: add visible-change event (#13415)

hetech 6 rokov pred
rodič
commit
c1b869d7ce

+ 1 - 0
examples/docs/en-US/cascader.md

@@ -1697,3 +1697,4 @@ Search and select options with a keyword.
 | active-item-change | triggers when active option of its parent changes, only works when `change-on-select` is `false` | an array of active options |
 | blur | triggers when Cascader blurs | (event: Event) |
 | focus | triggers when Cascader focuses | (event: Event) |
+| visible-change | triggers when the dropdown appears/disappears | true when it appears, and false otherwise |

+ 1 - 0
examples/docs/es/cascader.md

@@ -1702,4 +1702,5 @@ Buscar y seleccionar opciones con una palabra clave.
 | active-item-change | se dispara cuando la opcion activa del parent cambia, sólo funciona cuando `change-on-select` es `false`. | array de opciones activas |
 | blur               | se dispara cuando Cascader pierde el foco                    | (event: Event)            |
 | focus              | se dispara cuando Cascader obtiene el foco                   | (event: Event)            |
+| visible-change     | se dispara cuando el menu desplegable aparece o desaparece   | true cuando aparece, y false en otro caso |
 

+ 1 - 0
examples/docs/zh-CN/cascader.md

@@ -1697,3 +1697,4 @@
 | active-item-change | 当父级选项变化时触发的事件,仅在 `change-on-select` 为 `false` 时可用 | 各父级选项组成的数组 |
 | blur | 在 Cascader 失去焦点时触发 | (event: Event) |
 | focus | 在 Cascader 获得焦点时触发 | (event: Event) |
+| visible-change | 下拉框出现/隐藏时触发 | 出现则为 true,隐藏则为 false |

+ 3 - 3
examples/docs/zh-CN/steps.md

@@ -165,6 +165,6 @@
 ### Step Slot
 | name | 说明  |
 |----|----|
-| icon | 图标 |
-| title | 标题 |
-| description | 描述性文字 |
+| icon | 自定义图标 |
+| title | 自定义标题 |
+| description | 自定义描述性文字 |

+ 1 - 0
packages/cascader/src/main.vue

@@ -231,6 +231,7 @@ export default {
     menuVisible(value) {
       this.$refs.input.$refs.input.setAttribute('aria-expanded', value);
       value ? this.showMenu() : this.hideMenu();
+      this.$emit('visible-change', value);
     },
     value(value) {
       this.currentValue = value;