mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
chore(components): [date-picker] export instasnce type (#13618)
* chore(components): [date-picker] export instasnce type * move DatePickerInstance to instance.ts
This commit is contained in:
@@ -13,3 +13,4 @@ export default _DatePicker
|
||||
export const ElDatePicker = _DatePicker
|
||||
export * from './src/constants'
|
||||
export * from './src/props/date-picker'
|
||||
export type { DatePickerInstance } from './src/instance'
|
||||
|
||||
@@ -18,6 +18,7 @@ import { ROOT_PICKER_INJECTION_KEY } from './constants'
|
||||
|
||||
import { datePickerProps } from './props/date-picker'
|
||||
import { getPanel } from './panel-utils'
|
||||
import type { DatePickerExpose } from './instance'
|
||||
|
||||
dayjs.extend(localeData)
|
||||
dayjs.extend(advancedFormat)
|
||||
@@ -43,7 +44,7 @@ export default defineComponent({
|
||||
})
|
||||
|
||||
const commonPicker = ref<InstanceType<typeof CommonPicker>>()
|
||||
const refProps = {
|
||||
const refProps: DatePickerExpose = {
|
||||
focus: (focusStartInput = true) => {
|
||||
commonPicker.value?.focus(focusStartInput)
|
||||
},
|
||||
|
||||
12
packages/components/date-picker/src/instance.ts
Normal file
12
packages/components/date-picker/src/instance.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { ComponentPublicInstance } from 'vue'
|
||||
import type { DatePickerProps } from './props/date-picker'
|
||||
|
||||
export type DatePickerExpose = {
|
||||
focus: (focusStartInput: boolean) => void
|
||||
handleOpen: () => void
|
||||
handleClose: () => void
|
||||
}
|
||||
export type DatePickerInstance = ComponentPublicInstance<
|
||||
DatePickerProps,
|
||||
DatePickerExpose
|
||||
>
|
||||
Reference in New Issue
Block a user