Merge pull request #737 from trheyi/main

chore: enhance SUI details
This commit is contained in:
Max 2024-08-07 17:43:45 +08:00 committed by GitHub
commit 2f1e71d110
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 88 additions and 60 deletions

File diff suppressed because one or more lines are too long

View file

@ -127,6 +127,10 @@ const componentInitScriptTmpl = `
return __self.root.querySelector(selector);
}
this.queryAll = function (selector) {
return __self.root.querySelectorAll(selector);
}
this.render = function(name, data, option) {
const r = new __Render(__self, option);
return r.Exec(name, data);

View file

@ -106,6 +106,30 @@ function __sui_component(elm, component) {
this.store = new __sui_store(elm);
this.props = new __sui_props(elm);
this.state = component ? new __sui_state(component) : {};
const __self = this;
// @ts-ignore
this.$root = new __Query(this.root);
this.find = function (selector) {
// @ts-ignore
return new __Query(__self.root).find(selector);
};
this.query = function (selector) {
return __self.root.querySelector(selector);
};
this.queryAll = function (selector) {
return __self.root.querySelectorAll(selector);
};
this.render = function (name, data, option) {
// @ts-ignore
const r = new __Render(__self, option);
return r.Exec(name, data);
};
}
function __sui_event_handler(event, dataKeys, jsonKeys, target, root, handler) {