Radio: feat radio keydown is disabled

pull/21946/head
王叨叨 2022-06-24 17:44:36 +08:00
parent 8ab1db83c5
commit c4e3a43809
6 changed files with 15 additions and 1 deletions

View File

@ -178,6 +178,7 @@ Radio with button styles.
value / v-model | binding value | string / number / boolean | — | —
label | the value of Radio | string / number / boolean | — | —
disabled | whether Radio is disabled | boolean | — | false
controllable | whether keydown is disabled | boolean | — | false
border | whether to add a border around Radio | boolean | — | false
size | size of the Radio, only works when `border` is true | string | medium / small / mini | —
name | native 'name' attribute | string | — | —

View File

@ -176,6 +176,7 @@ Radio con estilo de botón.
| value / v-model | valor enlazado | string / number / boolean | — | — |
| label | el valor del Radio | string / number / boolean | — | — |
| disabled | si el Radio está deshabilitado | boolean | — | false |
| controllable | desactivar eventos de teclado | boolean | — | false |
| border | agregar borde alrededor del elemento Radio | boolean | — | false |
| size | tamaño del elemento Radio, solo funciona si `border` es verdadero | string | medium / small / mini | — |
| name | atributo nativo `name` | string | — | — |

View File

@ -178,6 +178,7 @@ Des radios affichés comme des boutons standards.
| value / v-model | La valeur liée. | string / number / boolean | — | — |
| label | La valeur du radio. | string / number / boolean | — | — |
| disabled | Si le radio est désactivé. | boolean | — | false |
| controllable | Désactiver les événements du clavier. | boolean | — | false |
| border | Si une bordure doit être affichée autour du radio. | boolean | — | false |
| size | Taille du radio, ne marche que si `border` est `true`. | string | medium / small / mini | — |
| name | Attribut 'name' natif. | string | — | — |

View File

@ -180,6 +180,7 @@
| value / v-model | 绑定值 | string / number / boolean | — | — |
| label | Radio 的 value | string / number / boolean | — | — |
| disabled | 是否禁用 | boolean | — | false |
| controllable | 是否禁用键盘事件 | boolean | — | false |
| border | 是否显示边框 | boolean | — | false |
| size | Radio 的尺寸,仅在 border 为真时有效 | string | medium / small / mini | — |
| name | 原生 name 属性 | string | — | — |

View File

@ -35,7 +35,11 @@
size: String,
fill: String,
textColor: String,
disabled: Boolean
disabled: Boolean,
controllable: {
type: Boolean,
default: false
}
},
computed: {
@ -67,6 +71,9 @@
},
methods: {
handleKeydown(e) { // radio
if (this.disabled || this.controllable) {
return;
}
const target = e.target;
const className = target.nodeName === 'INPUT' ? '[type=radio]' : '[role=radio]';
const radios = this.$el.querySelectorAll(className);

View File

@ -13,6 +13,9 @@ export declare class ElRadioGroup extends ElementUIComponent {
/** Whether the nesting radios are disabled */
disabled: boolean
/** Whether Keydown Event is disabled */
controllable: boolean
/** Font color when button is active */
textColor: string
}