Template
1
0
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:
ClariS 2024-11-29 22:58:50 +08:00
parent 3650da49df
commit 6319defeca
3 changed files with 6 additions and 3 deletions

View File

@ -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)) {

View File

@ -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

View File

@ -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
*/