fix(im): 迁移 Element UI 图标并修复 Vue 3 兼容问题

- 新增 migrate-legacy-icons 脚本,批量将旧图标替换为 legacy-el-icon 组件
- 多个组件中将 <i class="el-icon-*"> 统一改为 <legacy-el-icon name="el-icon-*">
- 将 size="mini"/"medium" 调整为 Element Plus 的 small/default
- 新增 legacy-el-icon 全局组件及图标映射逻辑
This commit is contained in:
田香琪
2026-07-22 13:36:44 +08:00
parent 12291ad4d5
commit 4bcaf14bad
39 changed files with 329 additions and 115 deletions

View File

@@ -16,6 +16,8 @@ import {
LoginMessage,
} from "@/components/chat/messaege";
import UserCard from "@/components/user/user-card/index";
import LegacyElIcon from "@/components/global/LegacyElIcon.vue";
import { resolveLegacyIcon } from "@/core/legacy-icon-map";
const messageComponents = [
AudioMessage,
@@ -39,5 +41,7 @@ export function registerGlobalComponents(app) {
messageComponents.forEach((component) => {
app.component(component.name, component);
});
app.component("legacy-el-icon", LegacyElIcon);
app.config.globalProperties.$legacyIcon = resolveLegacyIcon;
app.use(UserCard);
}

View File

@@ -0,0 +1,96 @@
import {
ArrowDown,
ArrowLeft,
ArrowRight,
Bell,
Bottom,
ChatDotRound,
ChatLineRound,
CircleCheck,
CircleClose,
CircleCloseFilled,
CirclePlus,
Clock,
Close,
Connection,
DataLine,
Delete,
DocumentCopy,
Edit,
Flag,
Folder,
FolderOpened,
Headset,
Loading,
Microphone,
MuteNotification,
Picture,
PictureRounded,
Plus,
Promotion,
Refresh,
RefreshLeft,
RefreshRight,
Remove,
Search,
Select,
Service,
Setting,
Top,
Upload,
User,
VideoPause,
VideoPlay,
} from "@element-plus/icons-vue";
/** Element UI `el-icon-*` class names → Element Plus icon components */
export const LEGACY_ICON_MAP = {
"el-icon-arrow-down": ArrowDown,
"el-icon-bell": Bell,
"el-icon-bottom": Bottom,
"el-icon-caret-left": ArrowLeft,
"el-icon-caret-right": ArrowRight,
"el-icon-chat-dot-round": ChatDotRound,
"el-icon-chat-line-round": ChatLineRound,
"el-icon-circle-close": CircleClose,
"el-icon-circle-plus-outline": CirclePlus,
"el-icon-close": Close,
"el-icon-close-notification": MuteNotification,
"el-icon-connection": Connection,
"el-icon-delete": Delete,
"el-icon-document-copy": DocumentCopy,
"el-icon-edit-outline": Edit,
"el-icon-error": CircleCloseFilled,
"el-icon-finished": Select,
"el-icon-folder": Folder,
"el-icon-folder-opened": FolderOpened,
"el-icon-headset": Headset,
"el-icon-loading": Loading,
"el-icon-microphone": Microphone,
"el-icon-picture": Picture,
"el-icon-picture-outline-round": PictureRounded,
"el-icon-plus": Plus,
"el-icon-position": Promotion,
"el-icon-refresh": Refresh,
"el-icon-refresh-left": RefreshLeft,
"el-icon-refresh-right": RefreshRight,
"el-icon-remove-outline": Remove,
"el-icon-s-data": DataLine,
"el-icon-s-flag": Flag,
"el-icon-s-promotion": Promotion,
"el-icon-search": Search,
"el-icon-service": Service,
"el-icon-setting": Setting,
"el-icon-success": CircleCheck,
"el-icon-time": Clock,
"el-icon-top": Top,
"el-icon-upload": Upload,
"el-icon-user": User,
"el-icon-video-pause": VideoPause,
"el-icon-video-play": VideoPlay,
};
export function resolveLegacyIcon(name) {
if (!name) return null;
return LEGACY_ICON_MAP[name] || null;
}