diff --git a/src/index.js b/src/index.js index 1f86093..532b8ff 100644 --- a/src/index.js +++ b/src/index.js @@ -228,9 +228,20 @@ export class Component extends HTMLElement { if (_name) { name = _name } - options = this.#getPropOptions(name) - this[name] = fixedValue(value, options) + value = fixedValue(value, options) + + if (options.attribute === false) { + if (value === null) { + return + } + if (value === this[name]) { + this.removeAttribute(name) + return + } + } + + this[name] = value } // 请求更新