fix: 激活gap/offset死配置; 优化style空对象遍历

This commit is contained in:
tianhao
2026-06-16 13:22:33 +08:00
parent b805c89112
commit 86bfcc4102
+3 -3
View File
@@ -184,9 +184,9 @@ class Toast {
el.style.cssText = `
display:flex;
flex-direction:column;
gap:12px;
gap:${this.config.gap || 12}px;
box-sizing:border-box;
padding:24px;
padding:${this.config.offset || 24}px;
max-width:100vw;
position:fixed;
z-index:${zIndex};
@@ -241,7 +241,7 @@ class Toast {
set('max-width', 'calc(100vw - 48px)');
set('width', widthValue);
// 用户自定义样式最后应用
if (this.config.style) {
if (this.config.style && Object.keys(this.config.style).length > 0) {
Object.entries(this.config.style).forEach(([k, v]) => { el.style[k] = v; });
}
}