mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
题解点赞功能
This commit is contained in:
1 parent
41261f8c4b
commit
4c2edc3948
5 files changed
+48
-21
No files matched your search
@@ -4,9 +4,7 @@ const res = [];
|
||||
function checkResources() {
|
||||
for (let i = res.length - 1; i >= 0; --i) {
|
||||
if (res[i].detached || !document.body.contains(res[i].$dom[0])) {
|
||||
if (!res[i].detached) {
|
||||
res[i].detach();
|
||||
}
|
||||
if (!res[i].detached) res[i].detach();
|
||||
res.splice(i, 1);
|
||||
}
|
||||
}
|
||||
@@ -36,15 +34,11 @@ export default class DOMAttachedObject {
|
||||
const key = this.DOMAttachKey;
|
||||
const Protoclass = this;
|
||||
const instance = this.get($singleObj);
|
||||
if (instance !== undefined) {
|
||||
return instance;
|
||||
}
|
||||
if (instance !== undefined) return instance;
|
||||
const newInstance = new Protoclass($singleObj, ...args);
|
||||
// $dom may be updated in constructor so that we use $dom instead
|
||||
// of $singleObj here.
|
||||
if (!newInstance.$dom) {
|
||||
return null;
|
||||
}
|
||||
if (!newInstance.$dom) return null;
|
||||
newInstance.$dom.data(key, newInstance);
|
||||
return newInstance;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user