Merge pull request #940 from trheyi/main

Update asset metadata and enhance event handling in SUI
This commit is contained in:
Max 2025-05-06 12:43:11 +08:00 committed by GitHub
commit 96cc9011a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 92 additions and 85 deletions

File diff suppressed because one or more lines are too long

View file

@ -167,7 +167,14 @@ function __sui_event_handler(event, dataKeys, jsonKeys, target, root, handler) {
function __sui_event_init(elm: Element) { function __sui_event_init(elm: Element) {
const bindEvent = (eventElm) => { const bindEvent = (eventElm) => {
const cn = eventElm.getAttribute("s:event-cn") || ""; let cn = eventElm.getAttribute("s:event-cn") || "";
// If has parent component, use the parent component name
const parent = eventElm.closest(`[s\\:cn]`);
if (parent) {
cn = parent.getAttribute("s:cn") || "";
}
if (cn == "") { if (cn == "") {
console.error("[SUI] Component name is required for event binding", elm); console.error("[SUI] Component name is required for event binding", elm);
return; return;