mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2025-04-25 19:22:31 +08:00
v3.3.6一些小问题修复
This commit is contained in:
parent
25645e1e52
commit
4e6f70280c
@ -9,6 +9,11 @@
|
|||||||
- 修复了鉴权方法的 bug
|
- 修复了鉴权方法的 bug
|
||||||
- 更新了 router permission 方法(路由守卫)
|
- 更新了 router permission 方法(路由守卫)
|
||||||
- 补充了一些模块文档
|
- 补充了一些模块文档
|
||||||
|
- 搜索支持以菜单模块的 icon 进行渲染,如果为空则以 icon table 默认填充
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
- 修复选中所搜结果后,菜单不能默认展开 bug
|
||||||
|
|
||||||
### 补充
|
### 补充
|
||||||
|
|
||||||
|
@ -7,15 +7,25 @@ import { useMenu } from '@/store'
|
|||||||
import { MENU_COLLAPSED_CONFIG, MENU_ACCORDION } from '@/appConfig/appConfig'
|
import { MENU_COLLAPSED_CONFIG, MENU_ACCORDION } from '@/appConfig/appConfig'
|
||||||
import { useVueRouter } from '@/router/helper/useVueRouter'
|
import { useVueRouter } from '@/router/helper/useVueRouter'
|
||||||
|
|
||||||
|
import type { MenuInst } from 'naive-ui'
|
||||||
|
|
||||||
const LayoutMenu = defineComponent({
|
const LayoutMenu = defineComponent({
|
||||||
name: 'LayoutMenu',
|
name: 'LayoutMenu',
|
||||||
setup() {
|
setup() {
|
||||||
|
const menuRef = ref<MenuInst | null>(null)
|
||||||
|
|
||||||
const menuStore = useMenu()
|
const menuStore = useMenu()
|
||||||
const { router } = useVueRouter()
|
const { router } = useVueRouter()
|
||||||
|
|
||||||
const { menuModelValueChange, collapsedMenu } = menuStore
|
const { menuModelValueChange, collapsedMenu } = menuStore
|
||||||
const modelMenuKey = computed({
|
const modelMenuKey = computed({
|
||||||
get: () => menuStore.menuKey,
|
get: () => {
|
||||||
|
nextTick().then(() => {
|
||||||
|
menuRef.value?.showOption?.(menuStore.menuKey as string)
|
||||||
|
})
|
||||||
|
|
||||||
|
return menuStore.menuKey
|
||||||
|
},
|
||||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||||
set: () => {},
|
set: () => {},
|
||||||
})
|
})
|
||||||
@ -41,6 +51,7 @@ const LayoutMenu = defineComponent({
|
|||||||
collapsedMenu,
|
collapsedMenu,
|
||||||
sideBarLogo,
|
sideBarLogo,
|
||||||
handleSideBarLogoClick,
|
handleSideBarLogoClick,
|
||||||
|
menuRef,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
@ -79,6 +90,7 @@ const LayoutMenu = defineComponent({
|
|||||||
''
|
''
|
||||||
)}
|
)}
|
||||||
<NMenu
|
<NMenu
|
||||||
|
ref="menuRef"
|
||||||
v-model:value={this.modelMenuKey}
|
v-model:value={this.modelMenuKey}
|
||||||
options={this.modelMenuOptions as NaiveMenuOptions[]}
|
options={this.modelMenuOptions as NaiveMenuOptions[]}
|
||||||
indent={MENU_COLLAPSED_CONFIG.MENU_COLLAPSED_INDENT}
|
indent={MENU_COLLAPSED_CONFIG.MENU_COLLAPSED_INDENT}
|
||||||
|
@ -120,6 +120,19 @@ const GlobalSeach = defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 渲染搜索菜单前缀图标, 如果没有则用 icon table 代替 */
|
||||||
|
const RenderPreIcon = (meta: AppRouteMeta) => {
|
||||||
|
const { icon } = meta
|
||||||
|
|
||||||
|
if (typeof icon === 'string') {
|
||||||
|
return <RayIcon name={icon} size="24" />
|
||||||
|
} else if (typeof icon === 'function') {
|
||||||
|
return () => icon
|
||||||
|
} else {
|
||||||
|
return <RayIcon name="table" size="24" />
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
on(window, 'keydown', registerKeyboard)
|
on(window, 'keydown', registerKeyboard)
|
||||||
})
|
})
|
||||||
@ -134,6 +147,7 @@ const GlobalSeach = defineComponent({
|
|||||||
tiptextOptions,
|
tiptextOptions,
|
||||||
handleSearchMenuOptions: debounce(handleSearchMenuOptions, 300),
|
handleSearchMenuOptions: debounce(handleSearchMenuOptions, 300),
|
||||||
handleSearchItemClick,
|
handleSearchItemClick,
|
||||||
|
RenderPreIcon,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
@ -167,7 +181,7 @@ const GlobalSeach = defineComponent({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div class="content-item-icon">
|
<div class="content-item-icon">
|
||||||
<RayIcon name="table" size="24" />
|
{this.RenderPreIcon(curr.meta)}
|
||||||
</div>
|
</div>
|
||||||
<div class="content-item-label">
|
<div class="content-item-label">
|
||||||
{curr.breadcrumbLabel}
|
{curr.breadcrumbLabel}
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
* - getAppLocales: 获取所有语言
|
* - getAppLocales: 获取所有语言
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
||||||
import { set } from 'lodash-es'
|
import { set } from 'lodash-es'
|
||||||
import { zhCN, dateZhCN } from 'naive-ui' // 导入 `naive ui` 中文包
|
import { zhCN, dateZhCN } from 'naive-ui' // 导入 `naive ui` 中文包
|
||||||
import { getCache } from '@use-utils/cache'
|
import { getCache } from '@use-utils/cache'
|
||||||
@ -25,7 +24,19 @@ import { APP_CATCH_KEY } from '@/appConfig/appConfig'
|
|||||||
|
|
||||||
import type { Recordable } from '@/types/type-utils'
|
import type { Recordable } from '@/types/type-utils'
|
||||||
|
|
||||||
export const mergeMessage = (langs: Record<string, any>, prefix = 'lang') => {
|
/**
|
||||||
|
*
|
||||||
|
* @param langs 语言包
|
||||||
|
* @param prefix 语言包前缀
|
||||||
|
*
|
||||||
|
* @remark 合并处理语言包内容, prefix 必填
|
||||||
|
*/
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
export const mergeMessage = (langs: Record<string, any>, prefix: string) => {
|
||||||
|
if (!prefix) {
|
||||||
|
throw new Error('Expected prefix to be string, got undefined instead')
|
||||||
|
}
|
||||||
|
|
||||||
const langsGather: Recordable = {}
|
const langsGather: Recordable = {}
|
||||||
|
|
||||||
Object.keys(langs).forEach((key) => {
|
Object.keys(langs).forEach((key) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user