fix: use urlwidget actiontype (not script) for internal navigation
Script-based getWidgetById+widgetBuild was async without await, causing black screen. urlwidget actiontype is Bricks' built-in navigation mechanism that properly handles async rendering.
This commit is contained in:
parent
1623c891ab
commit
8d8f9b58a5
@ -26,8 +26,10 @@
|
||||
"clear_label": "清除"
|
||||
},
|
||||
"binds": [{
|
||||
"wid": "self", "event": "search", "actiontype": "script", "target": "self",
|
||||
"script": "var kw=(event.params&&event.params.keyword)||event.keyword||'';var u='{{base}}?providerid={{active_provider}}&catelogid={{active_catelog}}&search='+encodeURIComponent(kw);var t=bricks.getWidgetById('sage_main_content',bricks.app);if(t){t.clear_widgets();bricks.widgetBuild({widgettype:'urlwidget',options:{url:u}},t);}"
|
||||
"wid": "self", "event": "search", "actiontype": "urlwidget",
|
||||
"target": "sage_main_content", "mode": "replace",
|
||||
"options": {"url": "{{base}}?providerid={{active_provider}}&catelogid={{active_catelog}}&search=${keyword}"},
|
||||
"params_mapping": {"keyword": "keyword"}
|
||||
}]
|
||||
}
|
||||
]
|
||||
@ -44,8 +46,9 @@
|
||||
"cwidth": 8, "cheight": 2
|
||||
},
|
||||
"binds": [{
|
||||
"wid": "self", "event": "click", "actiontype": "script", "target": "self",
|
||||
"script": "var t=bricks.getWidgetById('sage_main_content',bricks.app);if(t){t.clear_widgets();bricks.widgetBuild({widgettype:'urlwidget',options:{url:'{{base}}?providerid={{active_provider}}&search={{active_search}}'}},t);}"
|
||||
"wid": "self", "event": "click", "actiontype": "urlwidget",
|
||||
"target": "sage_main_content", "mode": "replace",
|
||||
"options": {"url": "{{base}}?providerid={{active_provider}}&search={{active_search}}"}
|
||||
}]
|
||||
}
|
||||
{% for c in catelogs %}
|
||||
@ -57,8 +60,9 @@
|
||||
"cwidth": 10, "cheight": 2
|
||||
},
|
||||
"binds": [{
|
||||
"wid": "self", "event": "click", "actiontype": "script", "target": "self",
|
||||
"script": "var t=bricks.getWidgetById('sage_main_content',bricks.app);if(t){t.clear_widgets();bricks.widgetBuild({widgettype:'urlwidget',options:{url:'{{base}}?providerid={{active_provider}}&catelogid={{c.id}}&search={{active_search}}'}},t);}"
|
||||
"wid": "self", "event": "click", "actiontype": "urlwidget",
|
||||
"target": "sage_main_content", "mode": "replace",
|
||||
"options": {"url": "{{base}}?providerid={{active_provider}}&catelogid={{c.id}}&search={{active_search}}"}
|
||||
}]
|
||||
}
|
||||
{% endfor %}
|
||||
@ -92,8 +96,9 @@
|
||||
"cwidth": 18
|
||||
},
|
||||
"binds": [{
|
||||
"wid": "self", "event": "click", "actiontype": "script", "target": "self",
|
||||
"script": "var t=bricks.getWidgetById('sage_main_content',bricks.app);if(t){t.clear_widgets();bricks.widgetBuild({widgettype:'urlwidget',options:{url:'{{base}}?catelogid={{active_catelog}}&search={{active_search}}'}},t);}"
|
||||
"wid": "self", "event": "click", "actiontype": "urlwidget",
|
||||
"target": "sage_main_content", "mode": "replace",
|
||||
"options": {"url": "{{base}}?catelogid={{active_catelog}}&search={{active_search}}"}
|
||||
}]
|
||||
}
|
||||
{% for p in providers %}
|
||||
@ -105,8 +110,9 @@
|
||||
"cwidth": 18
|
||||
},
|
||||
"binds": [{
|
||||
"wid": "self", "event": "click", "actiontype": "script", "target": "self",
|
||||
"script": "var t=bricks.getWidgetById('sage_main_content',bricks.app);if(t){t.clear_widgets();bricks.widgetBuild({widgettype:'urlwidget',options:{url:'{{base}}?providerid={{p.providerid}}&catelogid={{active_catelog}}&search={{active_search}}'}},t);}"
|
||||
"wid": "self", "event": "click", "actiontype": "urlwidget",
|
||||
"target": "sage_main_content", "mode": "replace",
|
||||
"options": {"url": "{{base}}?providerid={{p.providerid}}&catelogid={{active_catelog}}&search={{active_search}}"}
|
||||
}]
|
||||
}
|
||||
{% endfor %}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user