fix: type:check error
parent
729402b314
commit
d8bf10241f
|
@ -135,7 +135,6 @@ async function handleDelete(id: number) {
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #actions>
|
<template #actions>
|
||||||
<!-- <SettingOutlined key="setting" /> -->
|
|
||||||
<EditOutlined />
|
<EditOutlined />
|
||||||
<Dropdown
|
<Dropdown
|
||||||
:trigger="['hover']"
|
:trigger="['hover']"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, onMounted, ref, unref, useAttrs, useSlots, watch } from 'vue'
|
import { computed, onMounted, ref, unref, useAttrs, useSlots, watch } from 'vue'
|
||||||
|
import type { TreeProps } from 'ant-design-vue'
|
||||||
import { Tree } from 'ant-design-vue'
|
import { Tree } from 'ant-design-vue'
|
||||||
import { get } from 'lodash-es'
|
import { get } from 'lodash-es'
|
||||||
import type { DataNode } from 'ant-design-vue/es/tree'
|
import type { DataNode } from 'ant-design-vue/es/tree'
|
||||||
|
@ -18,7 +19,9 @@ const props = defineProps({
|
||||||
afterFetch: { type: Function as PropType<Fn> },
|
afterFetch: { type: Function as PropType<Fn> },
|
||||||
handleTree: propTypes.string.def(''),
|
handleTree: propTypes.string.def(''),
|
||||||
alwaysLoad: propTypes.bool.def(true),
|
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 emit = defineEmits(['optionsChange', 'change', 'update:value'])
|
||||||
const attrs = useAttrs()
|
const attrs = useAttrs()
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, reactive, ref, toRefs, unref, watch } from 'vue'
|
import { computed, reactive, ref, toRefs, unref, watch } from 'vue'
|
||||||
|
import type { MenuProps } from 'ant-design-vue'
|
||||||
import { Menu } from 'ant-design-vue'
|
import { Menu } from 'ant-design-vue'
|
||||||
import type { RouteLocationNormalizedLoaded } from 'vue-router'
|
import type { RouteLocationNormalizedLoaded } from 'vue-router'
|
||||||
import { useRouter } 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
|
const { beforeClickFn } = props
|
||||||
if (beforeClickFn && isFunction(beforeClickFn)) {
|
if (beforeClickFn && isFunction(beforeClickFn)) {
|
||||||
const flag = await beforeClickFn(key)
|
const flag = await beforeClickFn(key)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
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'
|
||||||
|
import type { Key } from './types'
|
||||||
import type { Menu } from '@/router/types'
|
import type { Menu } from '@/router/types'
|
||||||
|
|
||||||
import { MenuModeEnum, MenuTypeEnum } from '@/enums/menuEnum'
|
import { MenuModeEnum, MenuTypeEnum } from '@/enums/menuEnum'
|
||||||
|
@ -34,7 +35,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,9 +1,8 @@
|
||||||
// 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;
|
// mode: MenuModeEnum;
|
||||||
|
@ -15,11 +14,11 @@ export interface MenuState {
|
||||||
inlineIndent?: number
|
inlineIndent?: number
|
||||||
|
|
||||||
// 展开数组
|
// 展开数组
|
||||||
openKeys: string[]
|
openKeys: Key[]
|
||||||
|
|
||||||
// 当前选中的菜单项 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 { computed, toRaw, unref } from 'vue'
|
||||||
import { uniq } from 'lodash-es'
|
import { uniq } from 'lodash-es'
|
||||||
import { useTimeoutFn } from '@vueuse/core'
|
import { useTimeoutFn } from '@vueuse/core'
|
||||||
import type { MenuState } from './types'
|
import type { Key, MenuState } from './types'
|
||||||
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'
|
||||||
|
|
||||||
|
@ -48,14 +48,14 @@ export function useOpenKeys(menuState: MenuState, menus: Ref<MenuType[]>, mode:
|
||||||
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)
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, nextTick, onBeforeUnmount, onMounted, provide, ref, unref, watch } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import { toObject } from './util'
|
import { nextTick, onBeforeUnmount, onMounted, provide, ref, unref, watch } from 'vue'
|
||||||
import Bar from './bar'
|
import Bar from './bar'
|
||||||
import { addResizeListener, removeResizeListener } from '@/utils/event'
|
import { addResizeListener, removeResizeListener } from '@/utils/event'
|
||||||
|
import type { StyleValue } from '@/utils/types'
|
||||||
import componentSetting from '@/settings/componentSetting'
|
import componentSetting from '@/settings/componentSetting'
|
||||||
|
|
||||||
defineOptions({ name: 'Scrollbar' })
|
defineOptions({ name: 'Scrollbar' })
|
||||||
|
@ -13,7 +14,7 @@ const props = defineProps({
|
||||||
default: componentSetting.scrollbar?.native ?? false,
|
default: componentSetting.scrollbar?.native ?? false,
|
||||||
},
|
},
|
||||||
wrapStyle: {
|
wrapStyle: {
|
||||||
type: [String, Array],
|
type: [String, Array, Object] as PropType<StyleValue>,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
wrapClass: {
|
wrapClass: {
|
||||||
|
@ -49,13 +50,6 @@ const resize = ref()
|
||||||
|
|
||||||
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
|
|
||||||
})
|
|
||||||
|
|
||||||
function handleScroll() {
|
function 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
|
||||||
|
@ -108,8 +102,11 @@ onBeforeUnmount(() => {
|
||||||
<template>
|
<template>
|
||||||
<div class="scrollbar">
|
<div class="scrollbar">
|
||||||
<div
|
<div
|
||||||
ref="wrap" class="scrollbar__wrap" :class="[wrapClass, native ? '' : 'scrollbar__wrap--hidden-default']"
|
ref="wrap"
|
||||||
:style="style as any" @scroll="handleScroll"
|
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">
|
<component :is="tag" ref="resize" class="scrollbar__view" :class="[viewClass]" :style="viewStyle">
|
||||||
<slot />
|
<slot />
|
||||||
|
|
Loading…
Reference in New Issue