修复组件移除时, 状态未修改, 及事件未清空的bug

master 1.12.1
yutent 2024-11-22 16:21:47 +08:00
parent f70f4a54fb
commit 00e81bf2c5
2 changed files with 3 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{
"name": "wkit",
"version": "1.12.0",
"version": "1.12.1",
"type": "module",
"description": "A library for building fast, lightweight web components.",
"main": "dist/index.js",

View File

@ -295,6 +295,7 @@ export class Component extends HTMLElement {
if (this.keepAlive) {
nextTick(_ => this.deactivated())
} else {
this[__mounted__] = false
if (!document.body?.contains(this)) {
let $events = this.$events
if ($events) {
@ -302,6 +303,7 @@ export class Component extends HTMLElement {
for (let it of $events[name]) {
unbind(it.el, name, it.listener, it.options)
}
delete $events[name]
}
}
this.removed = true