fix(InputMenu): emit focus event (#2386)

Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
Tomy Kho
2024-10-18 21:09:04 +07:00
committed by GitHub
parent f59844bb61
commit 7802aacf3f
3 changed files with 30 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
<script setup lang="ts">
const open = ref(false)
const items = ref(['Backlog', 'Todo', 'In Progress', 'Done'])
const selected = ref('Backlog')
</script>
<template>
<UInputMenu
v-model="selected"
v-model:open="open"
:items="items"
@focus="open = true"
/>
</template>

View File

@@ -611,6 +611,16 @@ name: 'input-menu-open-example'
In this example, press :kbd{value="O"} to toggle the InputMenu.
::
### Control open state on focus
You can also use the `@focus` directive to control the open state.
::component-example
---
name: 'input-menu-open-focus-example'
---
::
### Control search term
Use the `v-model:search-term` directive to control the search term.