mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-11-07 17:38:55 +08:00
升级Vue3,iView替换ElementPlus
- 删除babel配置、更新依赖与入口初始化 - 全量替换UI组件、样式适配,新增迁移文档与标签/过滤器自动化替换脚本
This commit is contained in:
83
buyer/src/utils/iconMap.js
Normal file
83
buyer/src/utils/iconMap.js
Normal file
@@ -0,0 +1,83 @@
|
||||
import {
|
||||
Check,
|
||||
Close,
|
||||
Delete,
|
||||
Plus,
|
||||
ArrowDown,
|
||||
ArrowUp,
|
||||
ArrowRight,
|
||||
ArrowLeft,
|
||||
ShoppingCart,
|
||||
Camera,
|
||||
View,
|
||||
Warning,
|
||||
Help,
|
||||
Edit,
|
||||
InfoFilled,
|
||||
User,
|
||||
Lock,
|
||||
Iphone,
|
||||
Search,
|
||||
Document,
|
||||
Refresh,
|
||||
Link,
|
||||
Key,
|
||||
AlarmClock,
|
||||
Location,
|
||||
Star,
|
||||
StarFilled,
|
||||
CircleClose,
|
||||
ShoppingCartFull,
|
||||
Tickets,
|
||||
PriceTag,
|
||||
Money,
|
||||
} from "@element-plus/icons-vue";
|
||||
|
||||
/** 旧 iView type 字符串 → Element Plus 图标组件 */
|
||||
export const ICON_MAP = {
|
||||
"md-checkmark": Check,
|
||||
"md-close": Close,
|
||||
"md-trash": Delete,
|
||||
"md-add": Plus,
|
||||
"md-arrow-dropdown": ArrowDown,
|
||||
"md-arrow-dropup": ArrowUp,
|
||||
"md-person": User,
|
||||
"md-lock": Lock,
|
||||
"md-phone-portrait": Iphone,
|
||||
"md-key": Key,
|
||||
"md-link": Link,
|
||||
"md-refresh": Refresh,
|
||||
"ios-arrow-down": ArrowDown,
|
||||
"ios-arrow-up": ArrowUp,
|
||||
"ios-arrow-forward": ArrowRight,
|
||||
"ios-arrow-back": ArrowLeft,
|
||||
"ios-arrow-round-down": ArrowDown,
|
||||
"ios-arrow-round-forward": ArrowRight,
|
||||
"ios-cart-outline": ShoppingCart,
|
||||
"ios-camera": Camera,
|
||||
"ios-eye-outline": View,
|
||||
"ios-trash-outline": Delete,
|
||||
"ios-alert-outline": Warning,
|
||||
"ios-help-circle-outline": Help,
|
||||
"ios-add-circle-outline": Plus,
|
||||
"ios-information-circle": InfoFilled,
|
||||
"ios-search": Search,
|
||||
"ios-text-outline": Document,
|
||||
"ios-alarm-outline": AlarmClock,
|
||||
"md-qr-scanner": Iphone,
|
||||
edit: Edit,
|
||||
"trash-a": Delete,
|
||||
location: Location,
|
||||
"ios-heart": StarFilled,
|
||||
"md-close-circle": CircleClose,
|
||||
"ios-cart": ShoppingCartFull,
|
||||
"md-clipboard": Tickets,
|
||||
"md-pricetag": PriceTag,
|
||||
"logo-usd": Money,
|
||||
"ios-eye": View,
|
||||
"md-star": Star,
|
||||
};
|
||||
|
||||
export function resolveIcon(type) {
|
||||
return ICON_MAP[type] || InfoFilled;
|
||||
}
|
||||
71
buyer/src/utils/message.js
Normal file
71
buyer/src/utils/message.js
Normal file
@@ -0,0 +1,71 @@
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
|
||||
export const Message = {
|
||||
success(content) {
|
||||
return ElMessage.success(normalize(content));
|
||||
},
|
||||
error(content) {
|
||||
return ElMessage.error(normalize(content));
|
||||
},
|
||||
warning(content) {
|
||||
return ElMessage.warning(normalize(content));
|
||||
},
|
||||
info(content) {
|
||||
return ElMessage.info(normalize(content));
|
||||
},
|
||||
};
|
||||
|
||||
export const Notice = {
|
||||
open(options = {}) {
|
||||
const fn = Message[options.type] || Message.info;
|
||||
return fn(options.desc || options.title || "");
|
||||
},
|
||||
info(options) {
|
||||
return Message.info(options?.desc || options?.title || "");
|
||||
},
|
||||
success(options) {
|
||||
return Message.success(options?.desc || options?.title || "");
|
||||
},
|
||||
warning(options) {
|
||||
return Message.warning(options?.desc || options?.title || "");
|
||||
},
|
||||
error(options) {
|
||||
return Message.error(options?.desc || options?.title || "");
|
||||
},
|
||||
};
|
||||
|
||||
export const Modal = {
|
||||
confirm(options = {}) {
|
||||
const content = options.content || options.title || "确认操作?";
|
||||
return ElMessageBox.confirm(content, options.title || "提示", {
|
||||
confirmButtonText: options.okText || "确定",
|
||||
cancelButtonText: options.cancelText || "取消",
|
||||
type: options.type || "warning",
|
||||
})
|
||||
.then(() => {
|
||||
if (typeof options.onOk === "function") {
|
||||
return options.onOk();
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
if (typeof options.onCancel === "function") {
|
||||
options.onCancel();
|
||||
}
|
||||
});
|
||||
},
|
||||
remove() {
|
||||
ElMessageBox.close();
|
||||
},
|
||||
};
|
||||
|
||||
function normalize(content) {
|
||||
if (typeof content === "string") return content;
|
||||
if (content && content.content) return content.content;
|
||||
return String(content ?? "");
|
||||
}
|
||||
|
||||
export function setupLegacyMessage(app) {
|
||||
app.config.globalProperties.$Message = Message;
|
||||
app.config.globalProperties.$Modal = Modal;
|
||||
app.config.globalProperties.$Notice = Notice;
|
||||
}
|
||||
Reference in New Issue
Block a user