add vue全局声明、Ele全局实例、类型声明
This commit is contained in:
parent
bc4554baeb
commit
3267f59603
33
src/types/element.d.ts
vendored
33
src/types/element.d.ts
vendored
@ -1 +1,32 @@
|
|||||||
declare type ElTagType = '' | 'success' | 'warning' | 'info' | 'danger' | 'default' | 'primary';
|
import type * as ep from 'element-plus';
|
||||||
|
declare global {
|
||||||
|
declare type ElTagType = '' | 'success' | 'warning' | 'info' | 'danger' | 'default' | 'primary';
|
||||||
|
declare type ElFormInstance = InstanceType<typeof ep.ElForm>;
|
||||||
|
declare type ElTableInstance = InstanceType<typeof ep.ElTable>;
|
||||||
|
declare type ElTreeInstance = InstanceType<typeof ep.ElTree>;
|
||||||
|
declare type ElTreeSelectInstance = InstanceType<typeof ep.ElTreeSelect>;
|
||||||
|
declare type ElSelectInstance = InstanceType<typeof ep.ElSelect>;
|
||||||
|
declare type ElUploadInstance = InstanceType<typeof ep.ElUpload>;
|
||||||
|
declare type ElCardInstance = InstanceType<typeof ep.ElCard>;
|
||||||
|
declare type ElDialogInstance = InstanceType<typeof ep.ElDialog>;
|
||||||
|
declare type ElInputInstance = InstanceType<typeof ep.ElInput>;
|
||||||
|
declare type ElInputNumberInstance = InstanceType<typeof ep.ElInputNumber>;
|
||||||
|
declare type ElRadioInstance = InstanceType<typeof ep.ElRadio>;
|
||||||
|
declare type ElRadioGroupInstance = InstanceType<typeof ep.ElRadioGroup>;
|
||||||
|
declare type ElRadioButtonInstance = InstanceType<typeof ep.ElRadioButton>;
|
||||||
|
declare type ElCheckboxInstance = InstanceType<typeof ep.ElCheckbox>;
|
||||||
|
declare type ElCheckboxGroupInstance = InstanceType<typeof ep.ElCheckboxGroup>;
|
||||||
|
declare type ElSwitchInstance = InstanceType<typeof ep.ElSwitch>;
|
||||||
|
declare type ElDatePickerInstance = InstanceType<typeof ep.ElDatePicker>;
|
||||||
|
declare type ElTimePickerInstance = InstanceType<typeof ep.ElTimePicker>;
|
||||||
|
declare type ElTimeSelectInstance = InstanceType<typeof ep.ElTimeSelect>;
|
||||||
|
declare type ElCascaderInstance = InstanceType<typeof ep.ElCascader>;
|
||||||
|
declare type ElColorPickerInstance = InstanceType<typeof ep.ElColorPicker>;
|
||||||
|
declare type ElRateInstance = InstanceType<typeof ep.ElRate>;
|
||||||
|
declare type ElSliderInstance = InstanceType<typeof ep.ElSlider>;
|
||||||
|
declare type ElUploadInstance = InstanceType<typeof ep.ElUpload>;
|
||||||
|
|
||||||
|
declare type ElFormRules = ep.FormRules;
|
||||||
|
declare type DateModelType = ep.DateModelType;
|
||||||
|
declare type UploadFile = typeof ep.UploadFile;
|
||||||
|
}
|
||||||
|
26
src/types/global.d.ts
vendored
26
src/types/global.d.ts
vendored
@ -1,9 +1,15 @@
|
|||||||
import { FormRules } from 'element-plus';
|
import type { ComponentInternalInstance as ComponentInstance, PropType as VuePropType } from 'vue';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
/** vue Instance */
|
||||||
|
declare type ComponentInternalInstance = ComponentInstance;
|
||||||
|
/**vue */
|
||||||
|
declare type PropType<T> = VuePropType<T>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 界面字段隐藏属性
|
* 界面字段隐藏属性
|
||||||
*/
|
*/
|
||||||
interface FieldOption {
|
declare interface FieldOption {
|
||||||
key: number;
|
key: number;
|
||||||
label: string;
|
label: string;
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
@ -12,7 +18,7 @@ declare global {
|
|||||||
/**
|
/**
|
||||||
* 弹窗属性
|
* 弹窗属性
|
||||||
*/
|
*/
|
||||||
interface DialogOption {
|
declare interface DialogOption {
|
||||||
/**
|
/**
|
||||||
* 弹窗标题
|
* 弹窗标题
|
||||||
*/
|
*/
|
||||||
@ -23,7 +29,7 @@ declare global {
|
|||||||
visible: boolean;
|
visible: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface UploadOption {
|
declare interface UploadOption {
|
||||||
/** 设置上传的请求头部 */
|
/** 设置上传的请求头部 */
|
||||||
headers: { [key: string]: any };
|
headers: { [key: string]: any };
|
||||||
|
|
||||||
@ -34,7 +40,7 @@ declare global {
|
|||||||
/**
|
/**
|
||||||
* 导入属性
|
* 导入属性
|
||||||
*/
|
*/
|
||||||
interface ImportOption extends UploadOption {
|
declare interface ImportOption extends UploadOption {
|
||||||
/** 是否显示弹出层 */
|
/** 是否显示弹出层 */
|
||||||
open: boolean;
|
open: boolean;
|
||||||
/** 弹出层标题 */
|
/** 弹出层标题 */
|
||||||
@ -48,14 +54,14 @@ declare global {
|
|||||||
/**
|
/**
|
||||||
* 字典数据 数据配置
|
* 字典数据 数据配置
|
||||||
*/
|
*/
|
||||||
interface DictDataOption {
|
declare interface DictDataOption {
|
||||||
label: string;
|
label: string;
|
||||||
value: string;
|
value: string;
|
||||||
elTagType?: ElTagType;
|
elTagType?: ElTagType;
|
||||||
elTagClass?: string;
|
elTagClass?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface BaseEntity {
|
declare interface BaseEntity {
|
||||||
createBy?: any;
|
createBy?: any;
|
||||||
createDept?: any;
|
createDept?: any;
|
||||||
createTime?: string;
|
createTime?: string;
|
||||||
@ -68,15 +74,15 @@ declare global {
|
|||||||
* T : 表单数据
|
* T : 表单数据
|
||||||
* D : 查询参数
|
* D : 查询参数
|
||||||
*/
|
*/
|
||||||
interface PageData<T, D> {
|
declare interface PageData<T, D> {
|
||||||
form: T;
|
form: T;
|
||||||
queryParams: D;
|
queryParams: D;
|
||||||
rules: FormRules;
|
rules: ElFormRules;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 分页查询参数
|
* 分页查询参数
|
||||||
*/
|
*/
|
||||||
interface PageQuery {
|
declare interface PageQuery {
|
||||||
pageNum: number;
|
pageNum: number;
|
||||||
pageSize: number;
|
pageSize: number;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user