修复 提示条属性修改bug;

This commit is contained in:
袁涛
2025-08-13 09:59:09 +08:00
parent d893aeba19
commit 3f9dbff91e

View File

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