diff --git a/index.js b/index.js index 9bae171..5a49df9 100644 --- a/index.js +++ b/index.js @@ -1353,8 +1353,8 @@ class UI { } } else if (name == 'timeout') { this[name] = Number(newValue) - } else { - this[name] = newValue + } else if (name == 'type') { + this.Tip.className = this.Tip.part = `tip ${newValue}` } } // 初始化 @@ -1364,7 +1364,7 @@ class UI { const template = document.createElement('template') const style = document.createElement('style') this.Tip = document.createElement('div') - this.Tip.className = this.Tip.part = 'tip' + this.Tip.className = this.Tip.part = `tip ${type}` const contentSlot = document.createElement('slot') const prefixSlot = document.createElement('slot') contentSlot.name = 'content' @@ -1432,7 +1432,7 @@ class UI { height: 100%; fill: var(--close-color); } - .tip.info { + .tip { background: var(--background-color); color: var(--color); } @@ -1455,7 +1455,6 @@ class UI { this.hide() } - this.Tip.classList.add(type) this.Tip.style.display = hidden ? 'none' : 'flex' template.content.appendChild(prefixSlot) template.content.appendChild(contentSlot)