Skip to content

Commit

Permalink
fix: fix all types of errors, compatible with volar plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
anncwb committed Aug 17, 2021
1 parent a5ff592 commit e15b4f1
Show file tree
Hide file tree
Showing 35 changed files with 69 additions and 61 deletions.
1 change: 1 addition & 0 deletions src/components/Application/src/search/AppSearchModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import { SearchOutlined } from '@ant-design/icons-vue';
import AppSearchFooter from './AppSearchFooter.vue';
import Icon from '/@/components/Icon';
// @ts-ignore
import vClickOutside from '/@/directives/clickOutside';
import { useDesign } from '/@/hooks/web/useDesign';
import { useRefs } from '/@/hooks/core/useRefs';
Expand Down
5 changes: 3 additions & 2 deletions src/components/Button/src/BasicButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
</template>

<script lang="ts">
export default {
import { defineComponent } from 'vue';
export default defineComponent({
name: 'AButton',
inheritAttrs: false,
};
});
</script>
<script lang="ts" setup>
import { computed, unref } from 'vue';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Container/src/ScrollContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
return;
}
nextTick(() => {
const wrap = unref(scrollbar.wrap);
const wrap = unref(scrollbar.wrap) as any;
if (!wrap) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ContextMenu/src/ContextMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
name: 'ContextMenu',
props,
setup(props) {
const wrapRef = ref<ElRef>(null);
const wrapRef = ref(null);
const showRef = ref(false);
const getStyle = computed((): CSSProperties => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Cropper/src/CropperAvatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
t,
prefixCls,
register,
openModal,
openModal: openModal as any,
getIconWidth,
sourceValue,
getClass,
Expand Down
4 changes: 2 additions & 2 deletions src/components/Drawer/src/BasicDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@
onClose,
t,
prefixCls,
getMergeProps,
getMergeProps: getMergeProps as any,
getScrollContentStyle,
getProps,
getProps: getProps as any,
getLoading,
getBindValues,
getFooterHeight,
Expand Down
12 changes: 6 additions & 6 deletions src/components/Form/src/BasicForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</FormItem>
</template>

<FormAction v-bind="{ ...getProps, ...advanceState }" @toggle-advanced="handleToggleAdvanced">
<FormAction v-bind="getFormActionBindProps" @toggle-advanced="handleToggleAdvanced">
<template
#[item]="data"
v-for="item in ['resetBefore', 'submitBefore', 'advanceBefore', 'advanceAfter']"
Expand Down Expand Up @@ -62,8 +62,6 @@
import { basicProps } from './props';
import { useDesign } from '/@/hooks/web/useDesign';
import type { RowProps } from 'ant-design-vue/lib/grid/Row';
export default defineComponent({
name: 'BasicForm',
components: { FormItem, Form, Row, FormAction },
Expand Down Expand Up @@ -103,7 +101,7 @@
});
// Get uniform row style and Row configuration for the entire form
const getRow = computed((): RowProps => {
const getRow = computed((): Recordable => {
const { baseRowStyle = {}, rowProps } = unref(getProps);
return {
style: baseRowStyle,
Expand Down Expand Up @@ -282,10 +280,12 @@
getProps,
formElRef,
getSchema,
formActionType,
formActionType: formActionType as any,
setFormModel,
prefixCls,
getFormClass,
getFormActionBindProps: computed(
(): Recordable => ({ ...getProps.value, ...advanceState })
),
...formActionType,
};
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/Form/src/components/FormItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
plain: true,
});
}
return componentProps;
return componentProps as Recordable;
});
const getDisable = computed(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Loading/src/useLoading.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { LoadingProps } from './typing';
import type { Ref } from 'vue';

export interface UseLoadingOptions {
target?: HTMLElement | Ref<ElRef>;
target?: any;
props?: Partial<LoadingProps>;
}

Expand Down
3 changes: 2 additions & 1 deletion src/components/Markdown/src/Markdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<div ref="wrapRef"></div>
</template>
<script lang="ts">
import type { Ref } from 'vue';
import {
defineComponent,
ref,
Expand Down Expand Up @@ -30,7 +31,7 @@
emits: ['change', 'get', 'update:value'],
setup(props, { attrs, emit }) {
const wrapRef = ref<ElRef>(null);
const vditorRef = ref<Nullable<Vditor>>(null);
const vditorRef = ref(null) as Ref<Nullable<Vditor>>;
const initedRef = ref(false);
const modalFn = useModalContext();
Expand Down
6 changes: 2 additions & 4 deletions src/components/Menu/src/BasicMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@
const { prefixCls } = useDesign('basic-menu');
const { items, mode, accordion } = toRefs(props);
const { getCollapsed, getIsHorizontal, getTopMenuAlign, getSplit } = useMenuSetting();
const { getCollapsed, getTopMenuAlign, getSplit } = useMenuSetting();
const { currentRoute } = useRouter();
const { handleOpenChange, setOpenKeys, getOpenKeys } = useOpenKeys(
menuState,
items,
mode,
mode as any,
accordion
);
Expand Down Expand Up @@ -150,8 +150,6 @@
}
return {
prefixCls,
getIsHorizontal,
handleMenuClick,
getInlineCollapseOptions,
getMenuClass,
Expand Down
9 changes: 7 additions & 2 deletions src/components/Menu/src/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import type { PropType } from 'vue';
import { MenuModeEnum, MenuTypeEnum } from '/@/enums/menuEnum';
import { ThemeEnum } from '/@/enums/appEnum';
import { propTypes } from '/@/utils/propTypes';
import type { MenuTheme } from 'ant-design-vue';
import type { MenuMode } from 'ant-design-vue/lib/menu/src/interface';
export const basicProps = {
items: {
type: Array as PropType<Menu[]>,
Expand All @@ -14,15 +16,18 @@ export const basicProps = {
inlineIndent: propTypes.number.def(20),
// 菜单组件的mode属性
mode: {
type: String as PropType<MenuModeEnum>,
type: String as PropType<MenuMode>,
default: MenuModeEnum.INLINE,
},

type: {
type: String as PropType<MenuTypeEnum>,
default: MenuTypeEnum.MIX,
},
theme: propTypes.string.def(ThemeEnum.DARK),
theme: {
type: String as PropType<MenuTheme>,
default: ThemeEnum.DARK,
},
inlineCollapsed: propTypes.bool,
mixSider: propTypes.bool,

Expand Down
6 changes: 3 additions & 3 deletions src/components/Modal/src/BasicModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
}
// Custom title component: get title
const getMergeProps = computed((): ModalProps => {
const getMergeProps = computed((): Recordable => {
return {
...props,
...(unref(propsRef) as any),
Expand All @@ -118,7 +118,7 @@
});
// modal component does not need title and origin buttons
const getProps = computed((): ModalProps => {
const getProps = computed((): Recordable => {
const opt = {
...unref(getMergeProps),
visible: unref(visibleRef),
Expand Down Expand Up @@ -212,7 +212,7 @@
extHeightRef.value = height;
}
function handleTitleDbClick(e: ChangeEvent) {
function handleTitleDbClick(e) {
if (!props.canFullscreen) return;
e.stopPropagation();
handleFullScreen(e);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Modal/src/components/ModalWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
const modalDom = bodyDom.parentElement && bodyDom.parentElement.parentElement;
if (!modalDom) return;
const modalRect = getComputedStyle(modalDom).top;
const modalRect = getComputedStyle(modalDom as Element).top;
const modalTop = Number.parseInt(modalRect);
let maxHeight =
window.innerHeight -
Expand Down
2 changes: 1 addition & 1 deletion src/components/Preview/src/Preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
setup(props) {
const { prefixCls } = useDesign('image-preview');
const getImageList = computed(() => {
const getImageList = computed((): any[] => {
const { imageList } = props;
if (!imageList) {
return [];
Expand Down
2 changes: 1 addition & 1 deletion src/components/SimpleMenu/src/components/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
isRemoveAllPopup,
sliceIndex,
level: 0,
props,
props: props as any,
});
onMounted(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { InjectionKey, Ref } from 'vue';
import type { Emitter } from '/@/utils/mitt';
import { createContext, useContext } from '/@/hooks/core/useContext';
import mitt from '/@/utils/mitt';

export interface SimpleRootMenuContextProps {
rootMenuEmitter: typeof mitt;
rootMenuEmitter: Emitter;
activeName: Ref<string | number>;
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/Table/src/BasicTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@
wrapRef,
tableAction,
redoHeight,
getFormProps,
getFormProps: getFormProps as any,
replaceFormSlotKey,
getFormSlotKeys,
getWrapperClass,
Expand Down
6 changes: 3 additions & 3 deletions src/components/Table/src/components/TableAction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
.map((action) => {
const { popConfirm } = action;
return {
getPopupContainer: () => unref(table?.wrapRef.value) ?? document.body,
getPopupContainer: () => unref((table as any)?.wrapRef.value) ?? document.body,
type: 'link',
size: 'small',
...action,
Expand All @@ -107,7 +107,7 @@
});
});
const getDropdownList = computed(() => {
const getDropdownList = computed((): any[] => {
return (toRaw(props.dropDownActions) || [])
.filter((action) => {
return hasPermission(action.auth) && isIfShow(action);
Expand All @@ -133,7 +133,7 @@
function getTooltip(data: string | TooltipProps): TooltipProps {
return {
getPopupContainer: () => unref(table?.wrapRef.value) ?? document.body,
getPopupContainer: () => unref((table as any)?.wrapRef.value) ?? document.body,
placement: 'bottom',
...(isString(data) ? { title: data } : data),
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/Table/src/components/TableImg.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<template v-for="(img, index) in imgList" :key="img">
<Image
:width="size"
:style="{ 'margin-left': index === 0 ? 0 : margin }"
:style="{ marginLeft: index === 0 ? 0 : margin }"
:src="srcPrefix + img"
/>
</template>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Upload/src/UploadModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@
}
return {
columns: createTableColumns(),
actionColumn: createActionColumn(handleRemove),
columns: createTableColumns() as any[],
actionColumn: createActionColumn(handleRemove) as any,
register,
closeModal,
getHelpText,
Expand Down
4 changes: 2 additions & 2 deletions src/components/Upload/src/UploadPreviewModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@
register,
closeModal,
fileListRef,
columns: createPreviewColumns(),
actionColumn: createPreviewActionColumn({ handleRemove, handleDownload }),
columns: createPreviewColumns() as any[],
actionColumn: createPreviewActionColumn({ handleRemove, handleDownload }) as any,
};
},
});
Expand Down
12 changes: 4 additions & 8 deletions src/components/Verify/src/DragVerify.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="tsx">
import type { Ref } from 'vue';
import { defineComponent, ref, computed, unref, reactive, watch, watchEffect } from 'vue';
import { useTimeoutFn } from '/@/hooks/core/useTimeout';
import { useEventListener } from '/@/hooks/event/useEventListener';
Expand All @@ -23,7 +24,7 @@
const wrapElRef = ref<HTMLDivElement | null>(null);
const barElRef = ref<HTMLDivElement | null>(null);
const contentElRef = ref<HTMLDivElement | null>(null);
const actionElRef = ref<HTMLDivElement | null>(null);
const actionElRef = ref(null) as Ref<HTMLDivElement | null>;
useEventListener({
el: document,
Expand Down Expand Up @@ -324,13 +325,8 @@
color-stop(1, #333)
);
animation: slidetounlock 3s infinite;
-webkit-background-clip: text;
-moz-user-select: none;
-webkit-user-select: none;
-o-user-select: none;
-ms-user-select: none;
background-clip: text;
user-select: none;
-webkit-text-fill-color: transparent;
&.success {
-webkit-text-fill-color: @white;
Expand Down Expand Up @@ -363,7 +359,7 @@
}
}
@-webkit-keyframes slidetounlock {
@keyframes slidetounlock {
0% {
background-position: -120px 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/event/useIntersectionObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Ref, watchEffect, ref } from 'vue';

interface IntersectionObserverProps {
target: Ref<Element | null | undefined>;
root?: Ref<Element | null | undefined>;
root?: Ref<any>;
onIntersect: IntersectionObserverCallback;
rootMargin?: string;
threshold?: number;
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/event/useScrollTo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { isFunction, isUnDef } from '/@/utils/is';
import { ref, unref } from 'vue';

export interface ScrollToParams {
el: HTMLElement;
el: any;
to: number;
duration?: number;
callback?: () => any;
Expand Down
4 changes: 2 additions & 2 deletions src/layouts/default/menu/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@
<SimpleMenu {...menuProps} isSplitMenu={unref(getSplit)} items={menus} />
) : (
<BasicMenu
{...menuProps}
{...(menuProps as any)}
isHorizontal={props.isHorizontal}
type={unref(getMenuType)}
showLogo={unref(getIsShowLogo)}
mode={unref(getComputedMenuMode)}
mode={unref(getComputedMenuMode as any)}
items={menus}
/>
);
Expand Down
Loading

0 comments on commit e15b4f1

Please sign in to comment.