EASYAIuniappNewUI/node_modules/@tuniao/tnui-vue3-uniapp/components/region-picker/src/region-picker.ts
2025-02-08 18:50:38 +08:00

37 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '../../../constants'
import { buildProps, definePropType, isArray, isBoolean } from '../../../utils'
import { pickerBaseProps } from '../../base/common-props/picker'
import type { ExtractPropTypes } from 'vue'
export type RegionPickerModelValueType = Array<string>
export const regionPickerProps = buildProps({
...pickerBaseProps,
/**
* @description 地区选择器绑定的值可以传递省市区的code和name["11", "1101", "110101"] || ["广东省", "广州市", "天河区"]
*/
modelValue: {
type: definePropType<RegionPickerModelValueType>(Array),
default: [],
},
/**
* @description 显示/隐藏地区选择器
*/
open: Boolean,
})
export const regionPickerEmits = {
[UPDATE_MODEL_EVENT]: (value: RegionPickerModelValueType) => isArray(value),
'update:open': (value: boolean) => isBoolean(value),
// eslint-disable-next-line @typescript-eslint/no-unused-vars
[CHANGE_EVENT]: (value: RegionPickerModelValueType, item: any) => true,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
confirm: (value: RegionPickerModelValueType, item: any) => true,
cancel: () => true,
close: () => true,
}
export type RegionPickerProps = ExtractPropTypes<typeof regionPickerProps>
export type RegionPickerEmits = typeof regionPickerEmits