mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-08-06 19:07:25 +08:00
feat: 新增全局布局样式并提升组件响应式表现
- 在 global-layout.scss 中引入全局布局样式,统一页面宽度与对齐方式 - 更新多个组件与页面以优化响应式,包括宽度、间距及 flex 布局等调整 - 在 API 请求中增加 loading 状态管理,改善用户体验 - 优化领券中心与商品详情页,提升功能与 UI 一致性
This commit is contained in:
@@ -40,24 +40,48 @@ export const Notice = {
|
||||
export const Modal = {
|
||||
confirm(options = {}) {
|
||||
const content = options.content || options.title || "确认操作?";
|
||||
return ElMessageBox.confirm(content, options.title || "提示", {
|
||||
const title = options.title || "提示";
|
||||
return ElMessageBox.confirm(content, title, {
|
||||
confirmButtonText: options.okText || "确定",
|
||||
cancelButtonText: options.cancelText || "取消",
|
||||
type: options.type || "warning",
|
||||
})
|
||||
.then(() => {
|
||||
if (typeof options.onOk === "function") {
|
||||
return options.onOk();
|
||||
beforeClose: (action, instance, done) => {
|
||||
if (action !== "confirm") {
|
||||
done();
|
||||
if (typeof options.onCancel === "function") {
|
||||
options.onCancel();
|
||||
}
|
||||
return;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
if (typeof options.onCancel === "function") {
|
||||
options.onCancel();
|
||||
if (typeof options.onOk !== "function") {
|
||||
done();
|
||||
return;
|
||||
}
|
||||
});
|
||||
const result = options.onOk();
|
||||
if (result && typeof result.then === "function") {
|
||||
instance.confirmButtonLoading = true;
|
||||
result
|
||||
.then(() => done())
|
||||
.catch(() => {})
|
||||
.finally(() => {
|
||||
instance.confirmButtonLoading = false;
|
||||
});
|
||||
return;
|
||||
}
|
||||
done();
|
||||
},
|
||||
}).catch(() => {
|
||||
if (typeof options.onCancel === "function") {
|
||||
options.onCancel();
|
||||
}
|
||||
});
|
||||
},
|
||||
remove() {
|
||||
ElMessageBox.close();
|
||||
try {
|
||||
ElMessageBox.close();
|
||||
} catch (_) {
|
||||
// MessageBox 已关闭时忽略,避免操作已销毁 DOM 触发 parentNode 报错
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user