修复noop未定义的bug

pull/1/head
yutent 2023-03-23 19:42:46 +08:00
parent 9641f5b82a
commit d2ccaa5c3d
2 changed files with 8 additions and 4 deletions

View File

@ -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) {
$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

View File

@ -4,6 +4,8 @@
* @date 2023/03/07 22:11:30
*/
function noop() {}
export function $(selector, container) {
if (container) {
return container.querySelector(selector)