修复noop未定义的bug
parent
9641f5b82a
commit
d2ccaa5c3d
10
src/index.js
10
src/index.js
|
@ -56,7 +56,7 @@ export class Component extends HTMLElement {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this[key] = value
|
this[key] = value
|
||||||
this.#requestUpdate(name, oldValue)
|
this.$requestUpdate(name, oldValue)
|
||||||
if (options.observer) {
|
if (options.observer) {
|
||||||
options.observer.call(this, value, oldValue)
|
options.observer.call(this, value, oldValue)
|
||||||
}
|
}
|
||||||
|
@ -203,9 +203,11 @@ export class Component extends HTMLElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 请求更新
|
// 请求更新
|
||||||
#requestUpdate(name, oldValue) {
|
$requestUpdate(name, oldValue) {
|
||||||
this[__changed_props__].set(name, this[name])
|
if (name !== void 0) {
|
||||||
this[__prop2attr__](name, this[name])
|
this[__changed_props__].set(name, this[name])
|
||||||
|
this[__prop2attr__](name, this[name])
|
||||||
|
}
|
||||||
|
|
||||||
if (this[__pending__] === false) {
|
if (this[__pending__] === false) {
|
||||||
this[__pending__] = true
|
this[__pending__] = true
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
* @date 2023/03/07 22:11:30
|
* @date 2023/03/07 22:11:30
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
function noop() {}
|
||||||
|
|
||||||
export function $(selector, container) {
|
export function $(selector, container) {
|
||||||
if (container) {
|
if (container) {
|
||||||
return container.querySelector(selector)
|
return container.querySelector(selector)
|
||||||
|
|
Loading…
Reference in New Issue