修复设置attribute为false时,初始值不生效的bug
parent
8770c32e5b
commit
f8f749d32e
15
src/index.js
15
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
|
||||
}
|
||||
|
||||
// 请求更新
|
||||
|
|
Loading…
Reference in New Issue