feat: 解决编译问题,增加一键部署脚本。
This commit is contained in:
Vendored
+228
@@ -0,0 +1,228 @@
|
||||
// 为Arco Design Vue组件提供更全面的类型定义
|
||||
import { DefineComponent } from 'vue';
|
||||
|
||||
// 通用属性类型,可以被Arco组件共享
|
||||
interface ArcoBaseProps {
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
// 定义各种Arco组件的类型接口
|
||||
export interface ArcoMenuProps extends ArcoBaseProps {
|
||||
'mode'?: 'horizontal' | 'vertical' | 'pop' | 'popButton';
|
||||
'collapsed'?: boolean;
|
||||
'openKeys'?: string[];
|
||||
'selectedKeys'?: string[];
|
||||
'autoOpen'?: boolean;
|
||||
'autoOpenSelected'?: boolean;
|
||||
'levelIndent'?: number;
|
||||
'showCollapseButton'?: boolean;
|
||||
'onCollapse'?: (collapsed: boolean) => void;
|
||||
'v-model:collapsed'?: boolean;
|
||||
'v-model:open-keys'?: string[];
|
||||
'v-slots'?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface ArcoSubMenuProps extends ArcoBaseProps {
|
||||
'key'?: string | number | symbol;
|
||||
'title'?: string | (() => unknown);
|
||||
'selectable'?: boolean;
|
||||
'v-slots'?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface ArcoMenuItemProps extends ArcoBaseProps {
|
||||
'key'?: string | number | symbol;
|
||||
'disabled'?: boolean;
|
||||
'onClick'?: (event: Event) => void;
|
||||
'v-slots'?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
// 其他常用Arco组件类型定义
|
||||
export interface ArcoCardProps extends ArcoBaseProps {
|
||||
'title'?: string;
|
||||
'bordered'?: boolean;
|
||||
'hoverable'?: boolean;
|
||||
'loading'?: boolean;
|
||||
'size'?: 'small' | 'medium' | 'large';
|
||||
'v-slots'?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface ArcoButtonProps extends ArcoBaseProps {
|
||||
type?: 'primary' | 'secondary' | 'outline' | 'dashed' | 'text';
|
||||
status?: 'normal' | 'success' | 'warning' | 'danger';
|
||||
size?: 'mini' | 'small' | 'medium' | 'large';
|
||||
shape?: 'square' | 'circle' | 'round';
|
||||
loading?: boolean;
|
||||
disabled?: boolean;
|
||||
onClick?: (event: Event) => void;
|
||||
}
|
||||
|
||||
export interface ArcoLayoutProps extends ArcoBaseProps {
|
||||
'v-slots'?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface ArcoFormProps extends ArcoBaseProps {
|
||||
'model'?: Record<string, unknown>;
|
||||
'layout'?: 'horizontal' | 'vertical' | 'inline';
|
||||
'size'?: 'mini' | 'small' | 'medium' | 'large';
|
||||
'labelColProps'?: Record<string, unknown>;
|
||||
'wrapperColProps'?: Record<string, unknown>;
|
||||
'v-slots'?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface ArcoFormItemProps extends ArcoBaseProps {
|
||||
'field'?: string;
|
||||
'label'?: string;
|
||||
'required'?: boolean;
|
||||
'rules'?: unknown[];
|
||||
'validateStatus'?: 'success' | 'error' | 'validating';
|
||||
'v-slots'?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface ArcoTableProps extends ArcoBaseProps {
|
||||
'columns'?: unknown[];
|
||||
'data'?: unknown[];
|
||||
'pagination'?: boolean | object;
|
||||
'loading'?: boolean;
|
||||
'rowKey'?: string | ((record: unknown) => string);
|
||||
'v-slots'?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface ArcoTableColumnProps extends ArcoBaseProps {
|
||||
'title'?: string;
|
||||
'dataIndex'?: string;
|
||||
'width'?: number | string;
|
||||
'align'?: 'left' | 'center' | 'right';
|
||||
'fixed'?: 'left' | 'right';
|
||||
'v-slots'?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface ArcoSelectProps extends ArcoBaseProps {
|
||||
'modelValue'?: unknown;
|
||||
'options'?: unknown[];
|
||||
'multiple'?: boolean;
|
||||
'disabled'?: boolean;
|
||||
'loading'?: boolean;
|
||||
'placeholder'?: string;
|
||||
'v-slots'?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface ArcoOptionProps extends ArcoBaseProps {
|
||||
'value'?: unknown;
|
||||
'label'?: string;
|
||||
'disabled'?: boolean;
|
||||
'v-slots'?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
// 声明全局JSX类型
|
||||
declare global {
|
||||
namespace JSX {
|
||||
interface IntrinsicElements {
|
||||
// 基础组件
|
||||
'a-button': ArcoButtonProps;
|
||||
'a-card': ArcoCardProps;
|
||||
'a-menu': ArcoMenuProps;
|
||||
'a-menu-item': ArcoMenuItemProps;
|
||||
'a-sub-menu': ArcoSubMenuProps;
|
||||
|
||||
// 布局组件
|
||||
'a-layout': ArcoLayoutProps;
|
||||
'a-layout-header': ArcoBaseProps;
|
||||
'a-layout-content': ArcoBaseProps;
|
||||
'a-layout-footer': ArcoBaseProps;
|
||||
'a-layout-sider': ArcoBaseProps;
|
||||
'a-row': ArcoBaseProps;
|
||||
'a-col': ArcoBaseProps;
|
||||
'a-space': ArcoBaseProps;
|
||||
'a-divider': ArcoBaseProps;
|
||||
|
||||
// 表单组件
|
||||
'a-form': ArcoFormProps;
|
||||
'a-form-item': ArcoFormItemProps;
|
||||
'a-input': ArcoBaseProps;
|
||||
'a-textarea': ArcoBaseProps;
|
||||
'a-select': ArcoSelectProps;
|
||||
'a-option': ArcoOptionProps;
|
||||
'a-radio': ArcoBaseProps;
|
||||
'a-radio-group': ArcoBaseProps;
|
||||
'a-checkbox': ArcoBaseProps;
|
||||
'a-checkbox-group': ArcoBaseProps;
|
||||
'a-switch': ArcoBaseProps;
|
||||
|
||||
// 数据展示组件
|
||||
'a-table': ArcoTableProps;
|
||||
'a-table-column': ArcoTableColumnProps;
|
||||
'a-pagination': ArcoBaseProps;
|
||||
'a-tabs': ArcoBaseProps;
|
||||
'a-tab-pane': ArcoBaseProps;
|
||||
'a-dropdown': ArcoBaseProps;
|
||||
'a-dropdown-menu': ArcoBaseProps;
|
||||
'a-dropdown-item': ArcoBaseProps;
|
||||
'a-badge': ArcoBaseProps;
|
||||
'a-tag': ArcoBaseProps;
|
||||
|
||||
// 反馈组件
|
||||
'a-modal': ArcoBaseProps;
|
||||
'a-drawer': ArcoBaseProps;
|
||||
'a-alert': ArcoBaseProps;
|
||||
'a-spin': ArcoBaseProps;
|
||||
'a-progress': ArcoBaseProps;
|
||||
'a-result': ArcoBaseProps;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 扩展Vue的类型定义
|
||||
declare module '@vue/runtime-core' {
|
||||
export interface GlobalComponents {
|
||||
// 基础组件
|
||||
AButton: DefineComponent<ArcoButtonProps>;
|
||||
ACard: DefineComponent<ArcoCardProps>;
|
||||
AMenu: DefineComponent<ArcoMenuProps>;
|
||||
AMenuItem: DefineComponent<ArcoMenuItemProps>;
|
||||
ASubMenu: DefineComponent<ArcoSubMenuProps>;
|
||||
|
||||
// 布局组件
|
||||
ALayout: DefineComponent<ArcoLayoutProps>;
|
||||
ALayoutHeader: DefineComponent<ArcoBaseProps>;
|
||||
ALayoutContent: DefineComponent<ArcoBaseProps>;
|
||||
ALayoutFooter: DefineComponent<ArcoBaseProps>;
|
||||
ALayoutSider: DefineComponent<ArcoBaseProps>;
|
||||
ARow: DefineComponent<ArcoBaseProps>;
|
||||
ACol: DefineComponent<ArcoBaseProps>;
|
||||
ASpace: DefineComponent<ArcoBaseProps>;
|
||||
ADivider: DefineComponent<ArcoBaseProps>;
|
||||
|
||||
// 表单组件
|
||||
AForm: DefineComponent<ArcoFormProps>;
|
||||
AFormItem: DefineComponent<ArcoFormItemProps>;
|
||||
AInput: DefineComponent<ArcoBaseProps>;
|
||||
ATextarea: DefineComponent<ArcoBaseProps>;
|
||||
ASelect: DefineComponent<ArcoSelectProps>;
|
||||
AOption: DefineComponent<ArcoOptionProps>;
|
||||
ARadio: DefineComponent<ArcoBaseProps>;
|
||||
ARadioGroup: DefineComponent<ArcoBaseProps>;
|
||||
ACheckbox: DefineComponent<ArcoBaseProps>;
|
||||
ACheckboxGroup: DefineComponent<ArcoBaseProps>;
|
||||
ASwitch: DefineComponent<ArcoBaseProps>;
|
||||
|
||||
// 数据展示组件
|
||||
ATable: DefineComponent<ArcoTableProps>;
|
||||
ATableColumn: DefineComponent<ArcoTableColumnProps>;
|
||||
APagination: DefineComponent<ArcoBaseProps>;
|
||||
ATabs: DefineComponent<ArcoBaseProps>;
|
||||
ATabPane: DefineComponent<ArcoBaseProps>;
|
||||
ADropdown: DefineComponent<ArcoBaseProps>;
|
||||
ADropdownMenu: DefineComponent<ArcoBaseProps>;
|
||||
ADropdownItem: DefineComponent<ArcoBaseProps>;
|
||||
ABadge: DefineComponent<ArcoBaseProps>;
|
||||
ATag: DefineComponent<ArcoBaseProps>;
|
||||
|
||||
// 反馈组件
|
||||
AModal: DefineComponent<ArcoBaseProps>;
|
||||
ADrawer: DefineComponent<ArcoBaseProps>;
|
||||
AAlert: DefineComponent<ArcoBaseProps>;
|
||||
ASpin: DefineComponent<ArcoBaseProps>;
|
||||
AProgress: DefineComponent<ArcoBaseProps>;
|
||||
AResult: DefineComponent<ArcoBaseProps>;
|
||||
}
|
||||
}
|
||||
Vendored
+57
@@ -0,0 +1,57 @@
|
||||
// 为了支持Vue JSX和Arco Design Vue组件,我们需要适当扩展类型声明
|
||||
|
||||
// 引入Vue运行时核心类型
|
||||
import 'vue';
|
||||
|
||||
// 为Arco Design Vue组件定义基础接口
|
||||
interface ArcoMenuProps {
|
||||
'mode'?: 'horizontal' | 'vertical' | 'pop' | 'popButton';
|
||||
'collapsed'?: boolean;
|
||||
'openKeys'?: string[];
|
||||
'selectedKeys'?: string[];
|
||||
'autoOpen'?: boolean;
|
||||
'autoOpenSelected'?: boolean;
|
||||
'levelIndent'?: number;
|
||||
'showCollapseButton'?: boolean;
|
||||
'onCollapse'?: (collapsed: boolean) => void;
|
||||
'v-model:collapsed'?: boolean;
|
||||
'v-model:open-keys'?: string[];
|
||||
'v-slots'?: Record<string, unknown>;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
interface ArcoSubMenuProps {
|
||||
'key'?: string | number;
|
||||
'title'?: string | (() => unknown);
|
||||
'selectable'?: boolean;
|
||||
'v-slots'?: Record<string, unknown>;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
interface ArcoMenuItemProps {
|
||||
'key'?: string | number;
|
||||
'disabled'?: boolean;
|
||||
'onClick'?: (event: Event) => void;
|
||||
'v-slots'?: Record<string, unknown>;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
// 扩展Vue的类型定义
|
||||
declare module '@vue/runtime-core' {
|
||||
export interface GlobalComponents {
|
||||
AMenu: ArcoMenuProps;
|
||||
AMenuItem: ArcoMenuItemProps;
|
||||
ASubMenu: ArcoSubMenuProps;
|
||||
}
|
||||
}
|
||||
|
||||
// 扩展全局JSX声明
|
||||
declare global {
|
||||
namespace JSX {
|
||||
interface IntrinsicElements {
|
||||
'a-menu': ArcoMenuProps;
|
||||
'a-menu-item': ArcoMenuItemProps;
|
||||
'a-sub-menu': ArcoSubMenuProps;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user