mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-24 18:40:22 +08:00
chore: fix type:check error (#3169)
This commit is contained in:
parent
c24e0efd1d
commit
bbc2ede1aa
@ -39,8 +39,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #actions>
|
<template #actions>
|
||||||
<!-- <SettingOutlined key="setting" />-->
|
<EditOutlined />
|
||||||
<EditOutlined key="edit" />
|
|
||||||
<Dropdown
|
<Dropdown
|
||||||
:trigger="['hover']"
|
:trigger="['hover']"
|
||||||
:dropMenuList="[
|
:dropMenuList="[
|
||||||
@ -55,7 +54,7 @@
|
|||||||
]"
|
]"
|
||||||
popconfirm
|
popconfirm
|
||||||
>
|
>
|
||||||
<EllipsisOutlined key="ellipsis" />
|
<EllipsisOutlined />
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { type Recordable, type AnyFunction } from '@vben/types';
|
import { type Recordable, type AnyFunction } from '@vben/types';
|
||||||
import { type PropType, computed, defineComponent, watch, ref, onMounted, unref } from 'vue';
|
import { type PropType, computed, defineComponent, watch, ref, onMounted, unref } from 'vue';
|
||||||
import { Tree } from 'ant-design-vue';
|
import { Tree, TreeProps } from 'ant-design-vue';
|
||||||
import { isArray, isFunction } from '/@/utils/is';
|
import { isArray, isFunction } from '/@/utils/is';
|
||||||
import { get } from 'lodash-es';
|
import { get } from 'lodash-es';
|
||||||
import { propTypes } from '/@/utils/propTypes';
|
import { propTypes } from '/@/utils/propTypes';
|
||||||
@ -25,7 +25,9 @@
|
|||||||
immediate: { type: Boolean, default: true },
|
immediate: { type: Boolean, default: true },
|
||||||
resultField: propTypes.string.def(''),
|
resultField: propTypes.string.def(''),
|
||||||
afterFetch: { type: Function as PropType<AnyFunction> },
|
afterFetch: { type: Function as PropType<AnyFunction> },
|
||||||
value: [Array, Object, String, Number],
|
value: {
|
||||||
|
type: Array as PropType<TreeProps['selectedKeys']>,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
emits: ['options-change', 'change', 'update:value'],
|
emits: ['options-change', 'change', 'update:value'],
|
||||||
setup(props, { attrs, emit }) {
|
setup(props, { attrs, emit }) {
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { MenuState } from './types';
|
import type { MenuState } from './types';
|
||||||
import { computed, defineComponent, unref, reactive, watch, toRefs, ref } from 'vue';
|
import { computed, defineComponent, unref, reactive, watch, toRefs, ref } from 'vue';
|
||||||
import { Menu } from 'ant-design-vue';
|
import { Menu, MenuProps } from 'ant-design-vue';
|
||||||
import BasicSubMenuItem from './components/BasicSubMenuItem.vue';
|
import BasicSubMenuItem from './components/BasicSubMenuItem.vue';
|
||||||
import { MenuModeEnum, MenuTypeEnum } from '/@/enums/menuEnum';
|
import { MenuModeEnum, MenuTypeEnum } from '/@/enums/menuEnum';
|
||||||
import { useOpenKeys } from './useOpenKeys';
|
import { useOpenKeys } from './useOpenKeys';
|
||||||
@ -117,7 +117,7 @@
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
async function handleMenuClick({ key }: { key: string; keyPath: string[] }) {
|
const handleMenuClick: MenuProps['onClick'] = async ({ key }) => {
|
||||||
const { beforeClickFn } = props;
|
const { beforeClickFn } = props;
|
||||||
if (beforeClickFn && isFunction(beforeClickFn)) {
|
if (beforeClickFn && isFunction(beforeClickFn)) {
|
||||||
const flag = await beforeClickFn(key);
|
const flag = await beforeClickFn(key);
|
||||||
@ -127,7 +127,7 @@
|
|||||||
|
|
||||||
isClickGo.value = true;
|
isClickGo.value = true;
|
||||||
menuState.selectedKeys = [key];
|
menuState.selectedKeys = [key];
|
||||||
}
|
};
|
||||||
|
|
||||||
async function handleMenuChange(route?: RouteLocationNormalizedLoaded) {
|
async function handleMenuChange(route?: RouteLocationNormalizedLoaded) {
|
||||||
if (unref(isClickGo)) {
|
if (unref(isClickGo)) {
|
||||||
|
@ -4,6 +4,7 @@ import type { PropType } from 'vue';
|
|||||||
import { MenuModeEnum, MenuTypeEnum } from '/@/enums/menuEnum';
|
import { MenuModeEnum, MenuTypeEnum } from '/@/enums/menuEnum';
|
||||||
import { ThemeEnum } from '/@/enums/appEnum';
|
import { ThemeEnum } from '/@/enums/appEnum';
|
||||||
import { propTypes } from '/@/utils/propTypes';
|
import { propTypes } from '/@/utils/propTypes';
|
||||||
|
import type { Key } from './types';
|
||||||
import type { MenuTheme } from 'ant-design-vue';
|
import type { MenuTheme } from 'ant-design-vue';
|
||||||
import type { MenuMode } from 'ant-design-vue/lib/menu/src/interface';
|
import type { MenuMode } from 'ant-design-vue/lib/menu/src/interface';
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ export const basicProps = {
|
|||||||
isHorizontal: propTypes.bool,
|
isHorizontal: propTypes.bool,
|
||||||
accordion: propTypes.bool.def(true),
|
accordion: propTypes.bool.def(true),
|
||||||
beforeClickFn: {
|
beforeClickFn: {
|
||||||
type: Function as PropType<(key: string) => Promise<boolean>>,
|
type: Function as PropType<(key: Key) => Promise<boolean>>,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,25 +1,17 @@
|
|||||||
// import { ComputedRef } from 'vue';
|
export type Key = string | number;
|
||||||
// import { ThemeEnum } from '/@/enums/appEnum';
|
|
||||||
// import { MenuModeEnum } from '/@/enums/menuEnum';
|
|
||||||
export interface MenuState {
|
export interface MenuState {
|
||||||
// 默认选中的列表
|
// 默认选中的列表
|
||||||
defaultSelectedKeys: string[];
|
defaultSelectedKeys: Key[];
|
||||||
|
|
||||||
// 模式
|
|
||||||
// mode: MenuModeEnum;
|
|
||||||
|
|
||||||
// // 主题
|
|
||||||
// theme: ComputedRef<ThemeEnum> | ThemeEnum;
|
|
||||||
|
|
||||||
// 缩进
|
// 缩进
|
||||||
inlineIndent?: number;
|
inlineIndent?: number;
|
||||||
|
|
||||||
// 展开数组
|
// 展开数组
|
||||||
openKeys: string[];
|
openKeys: Key[];
|
||||||
|
|
||||||
// 当前选中的菜单项 key 数组
|
// 当前选中的菜单项 key 数组
|
||||||
selectedKeys: string[];
|
selectedKeys: Key[];
|
||||||
|
|
||||||
// 收缩状态下展开的数组
|
// 收缩状态下展开的数组
|
||||||
collapsedOpenKeys: string[];
|
collapsedOpenKeys: Key[];
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { MenuModeEnum } from '/@/enums/menuEnum';
|
import { MenuModeEnum } from '/@/enums/menuEnum';
|
||||||
import type { Menu as MenuType } from '/@/router/types';
|
import type { Menu as MenuType } from '/@/router/types';
|
||||||
import type { MenuState } from './types';
|
import type { MenuState, Key } from './types';
|
||||||
import { computed, Ref, toRaw, unref } from 'vue';
|
import { computed, Ref, toRaw, unref } from 'vue';
|
||||||
import { useTimeoutFn } from '@vben/hooks';
|
import { useTimeoutFn } from '@vben/hooks';
|
||||||
import { uniq } from 'lodash-es';
|
import { uniq } from 'lodash-es';
|
||||||
@ -53,13 +53,13 @@ export function useOpenKeys(
|
|||||||
menuState.openKeys = [];
|
menuState.openKeys = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleOpenChange(openKeys: string[]) {
|
function handleOpenChange(openKeys: Key[]) {
|
||||||
if (unref(mode) === MenuModeEnum.HORIZONTAL || !unref(accordion) || unref(getIsMixSidebar)) {
|
if (unref(mode) === MenuModeEnum.HORIZONTAL || !unref(accordion) || unref(getIsMixSidebar)) {
|
||||||
menuState.openKeys = openKeys;
|
menuState.openKeys = openKeys;
|
||||||
} else {
|
} else {
|
||||||
// const menuList = toRaw(menus.value);
|
// const menuList = toRaw(menus.value);
|
||||||
// getAllParentPath(menuList, path);
|
// getAllParentPath(menuList, path);
|
||||||
const rootSubMenuKeys: string[] = [];
|
const rootSubMenuKeys: Key[] = [];
|
||||||
for (const { children, path } of unref(menus)) {
|
for (const { children, path } of unref(menus)) {
|
||||||
if (children && children.length > 0) {
|
if (children && children.length > 0) {
|
||||||
rootSubMenuKeys.push(path);
|
rootSubMenuKeys.push(path);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<div
|
<div
|
||||||
ref="wrap"
|
ref="wrap"
|
||||||
:class="[wrapClass, 'scrollbar__wrap', native ? '' : 'scrollbar__wrap--hidden-default']"
|
:class="[wrapClass, 'scrollbar__wrap', native ? '' : 'scrollbar__wrap--hidden-default']"
|
||||||
:style="style"
|
:style="wrapStyle"
|
||||||
@scroll="handleScroll"
|
@scroll="handleScroll"
|
||||||
>
|
>
|
||||||
<component :is="tag" ref="resize" :class="['scrollbar__view', viewClass]" :style="viewStyle">
|
<component :is="tag" ref="resize" :class="['scrollbar__view', viewClass]" :style="viewStyle">
|
||||||
@ -19,7 +19,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { addResizeListener, removeResizeListener } from '/@/utils/event';
|
import { addResizeListener, removeResizeListener } from '/@/utils/event';
|
||||||
import componentSetting from '/@/settings/componentSetting';
|
import componentSetting from '/@/settings/componentSetting';
|
||||||
import { toObject } from './util';
|
|
||||||
import {
|
import {
|
||||||
defineComponent,
|
defineComponent,
|
||||||
ref,
|
ref,
|
||||||
@ -27,10 +26,11 @@
|
|||||||
onBeforeUnmount,
|
onBeforeUnmount,
|
||||||
nextTick,
|
nextTick,
|
||||||
provide,
|
provide,
|
||||||
computed,
|
|
||||||
unref,
|
unref,
|
||||||
watch,
|
watch,
|
||||||
|
type PropType,
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
|
import type { StyleValue } from '/@/utils/types';
|
||||||
import Bar from './bar';
|
import Bar from './bar';
|
||||||
|
|
||||||
const { scrollbar } = componentSetting;
|
const { scrollbar } = componentSetting;
|
||||||
@ -45,7 +45,7 @@
|
|||||||
default: scrollbar?.native ?? false,
|
default: scrollbar?.native ?? false,
|
||||||
},
|
},
|
||||||
wrapStyle: {
|
wrapStyle: {
|
||||||
type: [String, Array],
|
type: [String, Array, Object] as PropType<StyleValue>,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
wrapClass: {
|
wrapClass: {
|
||||||
@ -81,13 +81,6 @@
|
|||||||
|
|
||||||
provide('scroll-bar-wrap', wrap);
|
provide('scroll-bar-wrap', wrap);
|
||||||
|
|
||||||
const style = computed(() => {
|
|
||||||
if (Array.isArray(props.wrapStyle)) {
|
|
||||||
return toObject(props.wrapStyle);
|
|
||||||
}
|
|
||||||
return props.wrapStyle;
|
|
||||||
});
|
|
||||||
|
|
||||||
const handleScroll = () => {
|
const handleScroll = () => {
|
||||||
if (!props.native) {
|
if (!props.native) {
|
||||||
moveY.value = (unref(wrap).scrollTop * 100) / unref(wrap).clientHeight;
|
moveY.value = (unref(wrap).scrollTop * 100) / unref(wrap).clientHeight;
|
||||||
@ -137,7 +130,6 @@
|
|||||||
moveY,
|
moveY,
|
||||||
sizeWidth,
|
sizeWidth,
|
||||||
sizeHeight,
|
sizeHeight,
|
||||||
style,
|
|
||||||
wrap,
|
wrap,
|
||||||
resize,
|
resize,
|
||||||
update,
|
update,
|
||||||
|
@ -3,10 +3,11 @@ import type { BasicTableProps } from '../types/table';
|
|||||||
import { unref } from 'vue';
|
import { unref } from 'vue';
|
||||||
import { ROW_KEY } from '../const';
|
import { ROW_KEY } from '../const';
|
||||||
import { isString, isFunction } from '/@/utils/is';
|
import { isString, isFunction } from '/@/utils/is';
|
||||||
|
import type { Key } from 'ant-design-vue/lib/table/interface';
|
||||||
|
|
||||||
interface Options {
|
interface Options {
|
||||||
setSelectedRowKeys: (keys: string[]) => void;
|
setSelectedRowKeys: (keys: Key[]) => void;
|
||||||
getSelectRowKeys: () => string[];
|
getSelectRowKeys: () => Key[];
|
||||||
clearSelectedRowKeys: () => void;
|
clearSelectedRowKeys: () => void;
|
||||||
emit: EmitType;
|
emit: EmitType;
|
||||||
getAutoCreateKey: ComputedRef<boolean | undefined>;
|
getAutoCreateKey: ComputedRef<boolean | undefined>;
|
||||||
|
Loading…
Reference in New Issue
Block a user