mirror of
https://github.com/imdap/ruoyi-plus-vben5.git
synced 2026-05-13 06:42:10 +08:00
feat: 统一系统图标渲染方式并优化代码生成预览
- 将操作系统和浏览器图标从自定义组件改为使用 Iconify 类名,简化渲染逻辑 - 在登录信息和在线用户表格中,将操作系统图标与文本并排显示,提升可读性 - 重构代码生成预览功能,将图标配置移至独立文件,提高可维护性 - 更新 GitHub 图标引用,使用 Ant Design Vue 的 GithubOutlined 组件
This commit is contained in:
@@ -6,16 +6,7 @@ import type { DictFallback } from '#/components/dict/src/type';
|
||||
import { h } from 'vue';
|
||||
|
||||
import { JsonPreview } from '@vben/common-ui';
|
||||
import {
|
||||
AndroidIcon,
|
||||
DefaultOsIcon,
|
||||
IconifyIcon,
|
||||
IPhoneIcon,
|
||||
LinuxIcon,
|
||||
OSXIcon,
|
||||
VbenIcon,
|
||||
WindowsIcon,
|
||||
} from '@vben/icons';
|
||||
import { IconifyIcon, VbenIcon } from '@vben/icons';
|
||||
import { cn } from '@vben/utils';
|
||||
|
||||
import { Tag } from 'antdv-next';
|
||||
@@ -177,13 +168,15 @@ export function renderIconSpan(
|
||||
}
|
||||
|
||||
const osOptions = [
|
||||
{ icon: WindowsIcon, value: 'windows' },
|
||||
{ icon: LinuxIcon, value: 'linux' },
|
||||
{ icon: OSXIcon, value: 'osx' },
|
||||
{ icon: AndroidIcon, value: 'android' },
|
||||
{ icon: IPhoneIcon, value: 'iphone' },
|
||||
{ icon: 'icon-[devicon--windows8]', value: 'windows' },
|
||||
{ icon: 'icon-[wpf--macos]', value: 'osx' },
|
||||
{ icon: 'icon-[devicon--linux]', value: 'linux' },
|
||||
{ icon: 'icon-[flat-color-icons--android-os]', value: 'android' },
|
||||
{ icon: 'icon-[majesticons--iphone-x-apps-line]', value: 'ios' },
|
||||
];
|
||||
|
||||
const DefaultOsIcon = 'icon-[ic--outline-computer]';
|
||||
|
||||
/**
|
||||
* 浏览器图标
|
||||
* cn.hutool.http.useragent -> browers
|
||||
@@ -206,7 +199,7 @@ const browserOptions = [
|
||||
|
||||
const DefaultBrowserIcon = 'icon-[ph--browser-duotone]';
|
||||
|
||||
export function renderOsIcon(os: string, center = false) {
|
||||
export function renderOsIcon(os: string, className?: string) {
|
||||
if (!os) {
|
||||
return;
|
||||
}
|
||||
@@ -218,7 +211,7 @@ export function renderOsIcon(os: string, center = false) {
|
||||
current = osOptions[0];
|
||||
}
|
||||
const icon = current ? current.icon : DefaultOsIcon;
|
||||
return renderIconSpan(icon, os, center, '5px');
|
||||
return <span class={cn(icon, className)} />;
|
||||
}
|
||||
|
||||
export function renderBrowserIcon(browser: string, className?: string) {
|
||||
|
||||
Reference in New Issue
Block a user