feat:add view tag and findViewByTag
This commit is contained in:
21
doric-web/dist/index.js
vendored
21
doric-web/dist/index.js
vendored
@@ -1686,6 +1686,12 @@ class View {
|
||||
}
|
||||
return f;
|
||||
}
|
||||
findViewByTag(tag) {
|
||||
if (tag === this.tag) {
|
||||
return this;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
/** Anchor start*/
|
||||
get left() {
|
||||
return this.x;
|
||||
@@ -1922,6 +1928,21 @@ class Superview extends View {
|
||||
}
|
||||
}
|
||||
}
|
||||
findViewByTag(tag) {
|
||||
if (tag === this.tag) {
|
||||
return this;
|
||||
}
|
||||
return this.findViewTraversal(this, tag);
|
||||
}
|
||||
findViewTraversal(view, tag) {
|
||||
for (let v of view.allSubviews()) {
|
||||
let find = v.findViewByTag(tag);
|
||||
if (find) {
|
||||
return find;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
isDirty() {
|
||||
if (super.isDirty()) {
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user