chore: add base props type & update props define

This commit is contained in:
aalizzwell 2022-10-03 16:26:44 +08:00
parent ac68cb94d2
commit 5ee4b35efc
2 changed files with 30 additions and 31 deletions

View File

@ -1,5 +1,5 @@
import { ExtractPropTypes } from "vue";
import { ViewType, EnumType } from './types';
import { ViewType, EnumType, Type } from './types';
/**
*
@ -8,47 +8,35 @@ export const comboListProps = {
/**
*
*/
id: String,
id: Type(String),
/**
*
* false
*/
disabled: {
type: Boolean,
default: false
},
disabled: Type({ default: false, type: Boolean }),
/**
*
* false
*/
readonly: {
type: Boolean,
default: false
},
readonly: Type({ default: false, type: Boolean }),
/**
*
*/
maxLength: Number,
maxLength: Type(Number),
/**
*
*/
placeholder: String,
placeholder: Type(String),
/**
*
*
*/
enableClear: {
type: Boolean,
default: true
},
enableClear: Type({ default: true, type: Boolean }),
/**
*
*
*/
enableTitle: {
type: Boolean,
default: true
},
enableTitle: Type({ default: true, type: Boolean }),
/**
*
* text | tagViewType.Text
@ -57,17 +45,20 @@ export const comboListProps = {
/**
*
*/
mapFields: Object,
mapFields: Type(Object),
/**
*
*/
data: Array,
idField: {
type: String,
default: 'id'
},
valueField: {
}
data: Type(Array),
/**
* id字段
* id
*/
idField: Type({ default: 'id', type: String }),
/**
*
* id
*/
valueField: Type({ default: 'id', type: String })
};
export type ComboListProps = ExtractPropTypes<typeof comboListProps>;

View File

@ -1,4 +1,4 @@
import Constructor, { } from 'vue';
import { Prop } from 'vue';
/**
*
*/
@ -7,7 +7,15 @@ export enum ViewType {
Tag = 'tag'
};
/**
*
*
* @param options options
* @returns
*/
export function Type<T, D>(options: Prop<T, D>) {
return options;
}
/**
*
* @param defaultValue
* @param enumType
* @returns