fix: tabindex prop type (#2130)

Co-authored-by: Qian Jie <jie.qian@blockheaders.com>
This commit is contained in:
bastarder
2021-06-03 12:55:51 +08:00
committed by GitHub
parent 7b8c4853a9
commit 57e6e751ce
9 changed files with 11 additions and 11 deletions

View File

@@ -103,7 +103,7 @@ export default defineComponent({
default: 150,
},
tabindex: {
type: Number,
type: [Number, String],
default: 0,
},
effect: {

View File

@@ -210,7 +210,7 @@ export default defineComponent({
type: String,
},
tabindex: {
type: String,
type: [Number, String],
},
validateEvent: {
type: Boolean,

View File

@@ -4,7 +4,7 @@ import { on } from '@element-plus/utils/dom'
interface PopoverInstance {
events: Record<string, EventListenerOrEventListenerObject>
triggerRef: HTMLElement
tabindex: string
tabindex: string | number
}
const attachEvents = (el: HTMLElement, binding: DirectiveBinding, vnode: VNode) => {
@@ -12,7 +12,7 @@ const attachEvents = (el: HTMLElement, binding: DirectiveBinding, vnode: VNode)
const popover = vnode.dirs[0].instance.$refs[_ref] as PopoverInstance
if (popover) {
popover.triggerRef = el
el.setAttribute('tabindex', popover.tabindex)
el.setAttribute('tabindex', popover.tabindex as string)
// because v-popover cannot modify the vnode itself due to it has already been
Object.entries(popover.events).forEach(([eventName, e]) => {
on(el, eventName.toLowerCase().slice(2), e)

View File

@@ -45,7 +45,7 @@ export default defineComponent({
type: Boolean,
default: true,
},
tabindex: Number,
tabindex: [String, Number],
},
emits,
setup(props, ctx) {

View File

@@ -39,8 +39,8 @@ export default defineComponent({
default: true,
},
tabindex: {
type: Number,
default: 0,
type: [String, Number],
default: '0',
},
},
emits: [UPDATE_MODEL_EVENT],

View File

@@ -631,7 +631,7 @@ export default defineComponent ({
|autofocus | same as `autofocus` in native input | boolean | — | false |
|form | same as `form` in native input | string | — | — |
| label | label text | string | — | — |
| tabindex | input tabindex | string | - | - |
| tabindex | input tabindex | string / number | - | - |
| validate-event | whether to trigger form validation | boolean | - | true |
### Input slots

View File

@@ -630,7 +630,7 @@ export default defineComponent ({
| autofocus | Identique à `autofocus` dans l'input natif. | boolean | — | false |
| form | Identique à `form` dans l'input natif. | string | — | — |
| label | Texte du label. | string | — | — |
| tabindex | tabindex de l'input. | string | - | - |
| tabindex | tabindex de l'input. | string / number | - | - |
| validate-event | Si la validation doit avoir lieu. | boolean | - | true |
### Slots de l'Input

View File

@@ -631,7 +631,7 @@ export default defineComponent ({
|autofocus | ネイティブインプットの `autofocus` と同じ | boolean | — | false |
|form | ネイティブインプットの `form` と同じ | string | — | — |
| label | ラベルインデックス | string | — | — |
| tabindex | インプットタビインデックス | string | - | - |
| tabindex | インプットタビインデックス | string / number | - | - |
| validate-event | フォームバリデーションをトリガするかどうか | boolean | - | true |
### インプットスロット

View File

@@ -973,7 +973,7 @@ export default defineComponent ({
| autofocus | 原生属性,自动获取焦点 | boolean | true, false | false |
| form | 原生属性 | string | — | — |
| label | 输入框关联的label文字 | string | — | — |
| tabindex | 输入框的tabindex | string | - | - |
| tabindex | 输入框的tabindex | string / number | - | - |
| validate-event | 输入时是否触发表单的校验 | boolean | - | true |
### Input Slots