diff --git a/index.html b/index.html index bb6c0b7..03d2841 100644 --- a/index.html +++ b/index.html @@ -258,7 +258,7 @@

提供美观的下拉选择功能,支持选项分组、自定义样式和响应式设计。

- +
diff --git a/index.js b/index.js index 3a547b1..f261657 100644 --- a/index.js +++ b/index.js @@ -382,7 +382,6 @@ class UI { // 下拉框 this.Select = class Select extends HTMLElement { // 可用属性 - static observedAttributes = ['placeholder', 'list', 'value', 'current', 'disabled', 'focus'] static get observedAttributes() { return ['placeholder', 'list', 'value', 'current', 'disabled', 'focus'] } @@ -589,7 +588,7 @@ class UI { }) } } - // TODO:加载中 + // 加载中 this.Loading = class Loading extends HTMLElement { static observedAttributes = ['content', 'inline', 'hidden'] constructor() { @@ -1374,10 +1373,12 @@ class UI { }) } } - // TODO:提示条 + // 提示条 this.Tip = class Tip extends HTMLElement { // 可用属性 - static observedAttributes = ['content', 'type', 'hidden', 'timeout'] + static get observedAttributes() { + return ['content', 'type', 'hidden', 'timeout'] + } constructor() { super() // 提示条 @@ -1400,15 +1401,22 @@ class UI { } // 属性变化 attributeChangedCallback(name, oldValue, newValue) { - if (name == 'hidden') { - this[name] = newValue - if (this[name]) { - this.hide() - } - } else if (name == 'timeout') { - this[name] = Number(newValue) - } else if (name == 'type') { - this.Tip.className = this.Tip.part = `tip ${newValue}` + switch (name) { + case 'hidden': + this[name] = newValue + if (this[name]) { + this.hide() + } + break + case 'timeout': + this[name] = Number(newValue) + break + case 'type': + this.Tip.className = this.Tip.part = `tip ${newValue}` + break + case 'content': + this[name] = newValue + break } } // 初始化