types(Picker): add PickerInstance type (#9183)

This commit is contained in:
neverland
2021-08-04 17:41:36 +08:00
committed by GitHub
parent d36b4a901d
commit 5b525def3a
6 changed files with 98 additions and 44 deletions
+19 -21
View File
@@ -1,4 +1,11 @@
import { ref, watch, computed, PropType, defineComponent } from 'vue';
import {
ref,
watch,
computed,
PropType,
defineComponent,
ExtractPropTypes,
} from 'vue';
// Utils
import {
@@ -16,31 +23,20 @@ import { useExpose } from '../composables/use-expose';
// Components
import { Loading } from '../loading';
import Column, {
PICKER_KEY,
import Column, { PICKER_KEY } from './PickerColumn';
// Types
import type {
PickerColumn,
PickerOption,
PickerExpose,
PickerFieldNames,
PickerObjectColumn,
PickerObjectOption,
} from './PickerColumn';
PickerToolbarPosition,
} from './types';
const [name, bem, t] = createNamespace('picker');
export type PickerToolbarPosition = 'top' | 'bottom';
export type PickerFieldNames = {
text?: string;
values?: string;
children?: string;
};
export type {
PickerColumn,
PickerOption,
PickerObjectColumn,
PickerObjectOption,
};
export const pickerProps = {
title: String,
loading: Boolean,
@@ -63,6 +59,8 @@ export const pickerProps = {
},
};
export type PickerProps = ExtractPropTypes<typeof pickerProps>;
export default defineComponent({
name,
@@ -380,7 +378,7 @@ export default defineComponent({
watch(() => props.columns, format, { immediate: true });
useExpose({
useExpose<PickerExpose>({
confirm,
getValues,
setValues,