Skip to content

Commit

Permalink
fix(components): [dropdown] improve types (element-plus#12514)
Browse files Browse the repository at this point in the history
  • Loading branch information
ModyQyW authored Apr 20, 2023
1 parent 19e3164 commit 0f4aeaf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/examples/dropdown/dropdown-methods.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,19 @@

<script setup lang="ts">
import { ref } from 'vue'
const dropdown1 = ref()
import type { DropdownInstance } from 'element-plus'
const dropdown1 = ref<DropdownInstance>()
function handleVisible2(visible: any) {
if (!dropdown1.value) return
if (visible) {
dropdown1.value.handleClose()
} else {
dropdown1.value.handleOpen()
}
}
function showClick() {
if (!dropdown1.value) return
dropdown1.value.handleOpen()
}
</script>
Expand Down
1 change: 1 addition & 0 deletions packages/components/dropdown/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export default ElDropdown
export const ElDropdownItem = withNoopInstall(DropdownItem)
export const ElDropdownMenu = withNoopInstall(DropdownMenu)
export * from './src/dropdown'
export * from './src/instance'
export * from './src/tokens'
3 changes: 3 additions & 0 deletions packages/components/dropdown/src/instance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import type Dropdown from './dropdown.vue'

export type DropdownInstance = InstanceType<typeof Dropdown>

0 comments on commit 0f4aeaf

Please sign in to comment.