docs(time-select): [time-select] optimize docs and demos (#1418)

* docs(time-select): [time-select] optimize docs and demos

* docs(time-select): [time-select] optimize docs and demos

* docs(time-select): [time-select] optimize docs and demos

* docs(time-select): [time-select] optimize docs and demos
This commit is contained in:
李天佑 2024-02-28 17:49:06 +08:00 committed by GitHub
parent 7ef29bd08b
commit c6201942d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 6 deletions

View File

@ -13,7 +13,7 @@ const value = ref('')
const timeSelectRef = ref()
function hanleFocus() {
timeSelectRef.value.$el.querySelector('input').focus()
timeSelectRef.value.focus()
}
</script>

View File

@ -4,7 +4,6 @@ test('事件', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('time-select#focus')
await page.getByRole('button', { name: '手动获取焦点' }).click()
// 需要先解决time-select的focus事件
// const focus = page.getByRole('textbox', { name: '选择时间' })
// await expect(focus).toBeFocused()
const focus = page.getByRole('textbox', { name: '选择时间' })
await expect(focus).toBeFocused()
})

View File

@ -20,7 +20,7 @@ export default {
},
methods: {
hanleFocus() {
this.$refs.timeSelect.$el.querySelector('input').focus()
this.$refs.timeSelect.focus()
}
}
}

View File

@ -449,7 +449,7 @@ export const secondInputId =
export const focus =
({ api, props, vm }) =>
() =>
!props.isRange ? vm.$refs.reference.focus() : api.handleFocus()
!props.isRange ? vm.$refs.reference.querySelector('input').focus() : api.handleFocus()
export const blur = (state) => () => state.refInput.forEach((input) => input.blur())