fix: type error

This commit is contained in:
vben
2020-11-12 22:20:15 +08:00
parent 21e0548e34
commit ecfb702b09
37 changed files with 83 additions and 73 deletions

View File

@@ -3,10 +3,10 @@ import { isClient } from '/@/utils/is';
import { Options, Props } from './src/types';
import { createVNode, render } from 'vue';
const menuManager: {
doms: Element[];
domList: Element[];
resolve: Fn;
} = {
doms: [],
domList: [],
resolve: () => {},
};
export const createContextMenu = function (options: Options) {
@@ -32,9 +32,9 @@ export const createContextMenu = function (options: Options) {
const bodyClick = function () {
menuManager.resolve('');
};
menuManager.doms.push(container);
menuManager.domList.push(container);
const remove = function () {
menuManager.doms.forEach((dom: Element) => {
menuManager.domList.forEach((dom: Element) => {
try {
document.body.removeChild(dom);
} catch (error) {}
@@ -55,7 +55,7 @@ export const createContextMenu = function (options: Options) {
export const unMountedContextMenu = function () {
if (menuManager) {
menuManager.resolve('');
menuManager.doms = [];
menuManager.domList = [];
}
};

View File

@@ -34,6 +34,7 @@ export default defineComponent({
</>
)}
</Menu.Item>,
// @ts-ignore
divider && <Menu.Divider key={`d-${index}`} />,
];
})}

View File

@@ -96,7 +96,7 @@
// fix can't select the same excel
inputRefDom.value = '';
}
readerData(rawFile);
await readerData(rawFile);
}
/**

View File

@@ -2,7 +2,7 @@ import type { PropType } from 'vue';
import type { FormProps } from './types/form';
import type { FormSchema } from './types/form';
import type { ValidationRule } from 'ant-design-vue/lib/form/Form';
import type { TableActionType } from '../../Table/src/types/table';
import type { TableActionType } from '/@/components/Table';
import { defineComponent, computed, unref, toRef } from 'vue';
import { Form, Col } from 'ant-design-vue';
@@ -16,7 +16,7 @@ import { upperFirst, cloneDeep } from 'lodash-es';
import { useItemLabelWidth } from './hooks/useLabelWidth';
import { ComponentType } from './types';
import { isNumber } from '../../../utils/is';
import { isNumber } from '/@/utils/is';
export default defineComponent({
name: 'BasicFormItem',

View File

@@ -1,7 +1,7 @@
import type { FieldMapToTime, FormSchema } from './types/form';
import type { PropType } from 'vue';
import type { ColEx } from './types';
import { TableActionType } from '../../Table/src/types/table';
import { TableActionType } from '/@/components/Table';
export const basicProps = {
model: {

View File

@@ -6,7 +6,7 @@ import { Menu } from 'ant-design-vue';
import SearchInput from './SearchInput.vue';
import MenuContent from './MenuContent';
import { MenuModeEnum, MenuTypeEnum } from '/@/enums/menuEnum';
import { MenuModeEnum, MenuThemeEnum, MenuTypeEnum } from '/@/enums/menuEnum';
import { menuStore } from '/@/store/modules/menu';
import { appStore } from '/@/store/modules/app';
@@ -255,7 +255,7 @@ export default defineComponent({
{getSlot(slots, 'header')}
<SearchInput
class={!props.search ? 'hidden' : ''}
theme={props.theme}
theme={props.theme as MenuThemeEnum}
onChange={handleInputChange}
onClick={handleInputClick}
collapsed={getCollapsedState}

View File

@@ -22,6 +22,7 @@ export const BAR_MAP: BarMap = {
},
};
// @ts-ignore
export function renderThumbStyle({ move, size, bar }) {
const style = {} as any;
const translate = `translate${bar.axis}(${move}%)`;

View File

@@ -2,7 +2,7 @@ import { defineComponent, PropType } from 'vue';
import { Dropdown, Menu, Popconfirm } from 'ant-design-vue';
import Icon from '/@/components/Icon/index';
import { DownOutlined } from '@ant-design/icons-vue';
import { ActionItem } from '../types/tableAction';
import { ActionItem } from '/@/components/Table';
import Button from '/@/components/Button/index.vue';
const prefixCls = 'basic-table-action';
export default defineComponent({
@@ -26,7 +26,14 @@ export default defineComponent({
function renderButton(action: ActionItem, index: number) {
const { disabled = false, label, icon, color = '', type = 'link' } = action;
const button = (
<Button type={type} size="small" disabled={disabled} color={color} {...action} key={index}>
<Button
type={type as any}
size="small"
disabled={disabled}
color={color}
{...action}
key={index}
>
{() => (
<>
{label}

View File

@@ -22,7 +22,7 @@ export const FETCH_SETTING = {
};
// 配置通用排序函数
export function DEFAULT_SORT_FN(sortInfo: SorterResult<any>) {
export function DEFAULT_SORT_FN(sortInfo: SorterResult) {
const { field, order } = sortInfo;
return {
// 传给后台的排序字段你

View File

@@ -8,7 +8,7 @@ import type {
TableCustomRecord,
TableRowSelection,
} from './types/table';
import type { FormProps } from '/@/components/Form/index';
import type { FormProps } from '/@/components/Form';
import { DEFAULT_SORT_FN, FETCH_SETTING } from './const';
// 注释看 types/table

View File

@@ -1,6 +1,6 @@
import type { VNodeChild } from 'vue';
import type { PaginationProps } from './pagination';
import type { FormProps } from '/@/components/Form/index';
import type { FormProps } from '/@/components/Form';
import type {
ColumnProps,
TableRowSelection as ITableRowSelection,
@@ -125,7 +125,7 @@ export interface TableSetting {
export interface BasicTableProps<T = any> {
// 自定义排序方法
sortFn?: (sortInfo: SorterResult<any>) => any;
sortFn?: (sortInfo: SorterResult) => any;
// 显示表格设置
showTableSetting?: boolean;
tableSetting?: TableSetting;