Improve SUI Component element manipulation methods and add queryAll method
This commit is contained in:
parent
ae5e60aefa
commit
38884a7b0c
3 changed files with 73 additions and 60 deletions
120
data/bindata.go
120
data/bindata.go
File diff suppressed because one or more lines are too long
|
|
@ -127,6 +127,10 @@ const componentInitScriptTmpl = `
|
||||||
return __self.root.querySelector(selector);
|
return __self.root.querySelector(selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.queryAll = function (selector) {
|
||||||
|
return __self.root.querySelectorAll(selector);
|
||||||
|
}
|
||||||
|
|
||||||
this.render = function(name, data, option) {
|
this.render = function(name, data, option) {
|
||||||
const r = new __Render(__self, option);
|
const r = new __Render(__self, option);
|
||||||
return r.Exec(name, data);
|
return r.Exec(name, data);
|
||||||
|
|
|
||||||
|
|
@ -108,8 +108,12 @@ function __sui_component(elm, component) {
|
||||||
this.state = component ? new __sui_state(component) : {};
|
this.state = component ? new __sui_state(component) : {};
|
||||||
|
|
||||||
const __self = this;
|
const __self = this;
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
this.$root = new __Query(this.root);
|
this.$root = new __Query(this.root);
|
||||||
|
|
||||||
this.find = function (selector) {
|
this.find = function (selector) {
|
||||||
|
// @ts-ignore
|
||||||
return new __Query(__self.root).find(selector);
|
return new __Query(__self.root).find(selector);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -117,7 +121,12 @@ function __sui_component(elm, component) {
|
||||||
return __self.root.querySelector(selector);
|
return __self.root.querySelector(selector);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.queryAll = function (selector) {
|
||||||
|
return __self.root.querySelectorAll(selector);
|
||||||
|
};
|
||||||
|
|
||||||
this.render = function (name, data, option) {
|
this.render = function (name, data, option) {
|
||||||
|
// @ts-ignore
|
||||||
const r = new __Render(__self, option);
|
const r = new __Render(__self, option);
|
||||||
return r.Exec(name, data);
|
return r.Exec(name, data);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue