mirror of
https://github.com/un-pany/v3-admin-vite.git
synced 2025-04-22 03:49:19 +08:00
types: 路由中 elIcon 属性添加类型提示
This commit is contained in:
parent
3650da49df
commit
6319defeca
@ -1,6 +1,8 @@
|
||||
import type { App } from "vue"
|
||||
import * as ElementPlusIconsVue from "@element-plus/icons-vue"
|
||||
|
||||
export type TElementPlusIconName = keyof typeof ElementPlusIconsVue
|
||||
|
||||
export function installElementPlusIcons(app: App) {
|
||||
// 注册所有 Element Plus Icon
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
|
@ -160,7 +160,7 @@ export const constantRoutes: RouteRecordRaw[] = [
|
||||
path: "/link",
|
||||
meta: {
|
||||
title: "文档链接",
|
||||
elIcon: "link"
|
||||
elIcon: "Link"
|
||||
},
|
||||
children: [
|
||||
{
|
||||
@ -196,7 +196,7 @@ export const dynamicRoutes: RouteRecordRaw[] = [
|
||||
name: "Permission",
|
||||
meta: {
|
||||
title: "权限演示",
|
||||
elIcon: "lock",
|
||||
elIcon: "Lock",
|
||||
// 可以在根路由中设置角色
|
||||
roles: ["admin", "editor"],
|
||||
alwaysShow: true
|
||||
|
3
types/vue-router.d.ts
vendored
3
types/vue-router.d.ts
vendored
@ -1,3 +1,4 @@
|
||||
import type { TElementPlusIconName } from "@/plugins/element-plus-icons"
|
||||
import type { TSvgIconName } from "@@/components/SvgIcon/index.vue"
|
||||
import "vue-router"
|
||||
|
||||
@ -16,7 +17,7 @@ declare module "vue-router" {
|
||||
/**
|
||||
* @description 设置该路由的图标,直接使用 Element Plus 的 Icon(与 svgIcon 同时设置时,svgIcon 将优先生效)
|
||||
*/
|
||||
elIcon?: string
|
||||
elIcon?: TElementPlusIconName
|
||||
/**
|
||||
* @description 默认 false,设置 true 的时候该路由不会在侧边栏出现
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user