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