diff --git a/src/core.js b/src/core.js index 988ae73..28b53ca 100644 --- a/src/core.js +++ b/src/core.js @@ -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; }); } }