fix: type:check error
parent
729402b314
commit
d8bf10241f
|
@ -135,7 +135,6 @@ async function handleDelete(id: number) {
|
|||
</div>
|
||||
</template>
|
||||
<template #actions>
|
||||
<!-- <SettingOutlined key="setting" /> -->
|
||||
<EditOutlined />
|
||||
<Dropdown
|
||||
:trigger="['hover']"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import { computed, onMounted, ref, unref, useAttrs, useSlots, watch } from 'vue'
|
||||
import type { TreeProps } from 'ant-design-vue'
|
||||
import { Tree } from 'ant-design-vue'
|
||||
import { get } from 'lodash-es'
|
||||
import type { DataNode } from 'ant-design-vue/es/tree'
|
||||
|
@ -18,7 +19,9 @@ const props = defineProps({
|
|||
afterFetch: { type: Function as PropType<Fn> },
|
||||
handleTree: propTypes.string.def(''),
|
||||
alwaysLoad: propTypes.bool.def(true),
|
||||
value: [Array, Object, String, Number],
|
||||
value: {
|
||||
type: Array as PropType<TreeProps['selectedKeys']>,
|
||||
},
|
||||
})
|
||||
const emit = defineEmits(['optionsChange', 'change', 'update:value'])
|
||||
const attrs = useAttrs()
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import { computed, reactive, ref, toRefs, unref, watch } from 'vue'
|
||||
import type { MenuProps } from 'ant-design-vue'
|
||||
import { Menu } from 'ant-design-vue'
|
||||
import type { RouteLocationNormalizedLoaded } from 'vue-router'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
@ -88,7 +89,7 @@ listenerRouteChange((route) => {
|
|||
},
|
||||
)
|
||||
|
||||
async function handleMenuClick({ key }) {
|
||||
const handleMenuClick: MenuProps['onClick'] = async ({ key }) => {
|
||||
const { beforeClickFn } = props
|
||||
if (beforeClickFn && isFunction(beforeClickFn)) {
|
||||
const flag = await beforeClickFn(key)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import type { MenuTheme } from 'ant-design-vue'
|
||||
import type { MenuMode } from 'ant-design-vue/lib/menu/src/interface'
|
||||
import type { Key } from './types'
|
||||
import type { Menu } from '@/router/types'
|
||||
|
||||
import { MenuModeEnum, MenuTypeEnum } from '@/enums/menuEnum'
|
||||
|
@ -34,7 +35,7 @@ export const basicProps = {
|
|||
isHorizontal: propTypes.bool,
|
||||
accordion: propTypes.bool.def(true),
|
||||
beforeClickFn: {
|
||||
type: Function as PropType<(key: string) => Promise<boolean>>,
|
||||
type: Function as PropType<(key: Key) => Promise<boolean>>,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
// import { ComputedRef } from 'vue';
|
||||
// import { ThemeEnum } from '@/enums/appEnum';
|
||||
// import { MenuModeEnum } from '@/enums/menuEnum';
|
||||
export type Key = string | number
|
||||
|
||||
export interface MenuState {
|
||||
// 默认选中的列表
|
||||
defaultSelectedKeys: string[]
|
||||
defaultSelectedKeys: Key[]
|
||||
|
||||
// 模式
|
||||
// mode: MenuModeEnum;
|
||||
|
@ -15,11 +14,11 @@ export interface MenuState {
|
|||
inlineIndent?: number
|
||||
|
||||
// 展开数组
|
||||
openKeys: string[]
|
||||
openKeys: Key[]
|
||||
|
||||
// 当前选中的菜单项 key 数组
|
||||
selectedKeys: string[]
|
||||
selectedKeys: Key[]
|
||||
|
||||
// 收缩状态下展开的数组
|
||||
collapsedOpenKeys: string[]
|
||||
collapsedOpenKeys: Key[]
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import type { Ref } from 'vue'
|
|||
import { computed, toRaw, unref } from 'vue'
|
||||
import { uniq } from 'lodash-es'
|
||||
import { useTimeoutFn } from '@vueuse/core'
|
||||
import type { MenuState } from './types'
|
||||
import type { Key, MenuState } from './types'
|
||||
import { MenuModeEnum } from '@/enums/menuEnum'
|
||||
import type { Menu as MenuType } from '@/router/types'
|
||||
|
||||
|
@ -48,14 +48,14 @@ export function useOpenKeys(menuState: MenuState, menus: Ref<MenuType[]>, mode:
|
|||
menuState.openKeys = []
|
||||
}
|
||||
|
||||
function handleOpenChange(openKeys: string[]) {
|
||||
function handleOpenChange(openKeys: Key[]) {
|
||||
if (unref(mode) === MenuModeEnum.HORIZONTAL || !unref(accordion) || unref(getIsMixSidebar)) {
|
||||
menuState.openKeys = openKeys
|
||||
}
|
||||
else {
|
||||
// const menuList = toRaw(menus.value);
|
||||
// getAllParentPath(menuList, path);
|
||||
const rootSubMenuKeys: string[] = []
|
||||
const rootSubMenuKeys: Key[] = []
|
||||
for (const { children, path } of unref(menus)) {
|
||||
if (children && children.length > 0)
|
||||
rootSubMenuKeys.push(path)
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<script lang="ts" setup>
|
||||
import { computed, nextTick, onBeforeUnmount, onMounted, provide, ref, unref, watch } from 'vue'
|
||||
import { toObject } from './util'
|
||||
import type { PropType } from 'vue'
|
||||
import { nextTick, onBeforeUnmount, onMounted, provide, ref, unref, watch } from 'vue'
|
||||
import Bar from './bar'
|
||||
import { addResizeListener, removeResizeListener } from '@/utils/event'
|
||||
import type { StyleValue } from '@/utils/types'
|
||||
import componentSetting from '@/settings/componentSetting'
|
||||
|
||||
defineOptions({ name: 'Scrollbar' })
|
||||
|
@ -13,7 +14,7 @@ const props = defineProps({
|
|||
default: componentSetting.scrollbar?.native ?? false,
|
||||
},
|
||||
wrapStyle: {
|
||||
type: [String, Array],
|
||||
type: [String, Array, Object] as PropType<StyleValue>,
|
||||
default: '',
|
||||
},
|
||||
wrapClass: {
|
||||
|
@ -49,13 +50,6 @@ const resize = ref()
|
|||
|
||||
provide('scroll-bar-wrap', wrap)
|
||||
|
||||
const style = computed(() => {
|
||||
if (Array.isArray(props.wrapStyle))
|
||||
return toObject(props.wrapStyle)
|
||||
|
||||
return props.wrapStyle
|
||||
})
|
||||
|
||||
function handleScroll() {
|
||||
if (!props.native) {
|
||||
moveY.value = (unref(wrap).scrollTop * 100) / unref(wrap).clientHeight
|
||||
|
@ -108,8 +102,11 @@ onBeforeUnmount(() => {
|
|||
<template>
|
||||
<div class="scrollbar">
|
||||
<div
|
||||
ref="wrap" class="scrollbar__wrap" :class="[wrapClass, native ? '' : 'scrollbar__wrap--hidden-default']"
|
||||
:style="style as any" @scroll="handleScroll"
|
||||
ref="wrap"
|
||||
class="scrollbar__wrap"
|
||||
:class="[wrapClass, native ? '' : 'scrollbar__wrap--hidden-default']"
|
||||
:style="wrapStyle"
|
||||
@scroll="handleScroll"
|
||||
>
|
||||
<component :is="tag" ref="resize" class="scrollbar__view" :class="[viewClass]" :style="viewStyle">
|
||||
<slot />
|
||||
|
|
Loading…
Reference in New Issue