From 16c8ed4c70962cb85f7a183ec989006068722a5d Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 12 Apr 2024 14:05:13 +0800 Subject: [PATCH] bugfix --- bricks/tab.js | 21 +++++++++++++-------- examples/form.ui | 23 +++++++++++------------ examples/tab.ui | 4 ++-- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/bricks/tab.js b/bricks/tab.js index 078ec27..510aabb 100755 --- a/bricks/tab.js +++ b/bricks/tab.js @@ -94,16 +94,21 @@ bricks.TabPanel = class extends bricks.Layout { this.cur_tab_name = name; return; } - w = await bricks.widgetBuild(items[i].content); - if (! w){ - bricks.debug('TabPanel():create content error', items[i].content); + try { + w = await bricks.widgetBuild(items[i].content, this, {}); + if (! w){ + bricks.debug('TabPanel():create content error', items[i].content); + return; + } + this.content_buffer[tdesc.name] = w; + this.content_container.clear_widgets(); + this.content_container.add_widget(w); + this.cur_tab_name = tdesc.name; return; } - this.content_buffer[tdesc.name] = w; - this.content_container.clear_widgets(); - this.content_container.add_widget(w); - this.cur_tab_name = tdesc.name; - return; + catch (e) { + console.log('except ', e) + } } } bricks.debug('TabPanel(): click event handled but noting to do', tdesc) diff --git a/examples/form.ui b/examples/form.ui index 7b696f5..601d7ab 100644 --- a/examples/form.ui +++ b/examples/form.ui @@ -64,20 +64,19 @@ "uitype":"email", "name":"email", "label":"Email", - 'required':true + "required":true }, { "uitype":"tel", "name":"tel", - "pattern":"{\d}3-{\d}4-{\d}4", "label":"Tel", - 'required':true + "required":true }, { "uitype":"file", "name":"file", "label":"File", - 'required':true + "required":true }, { "uitype":"str", @@ -86,7 +85,7 @@ "value":"tlegre", "name":"name", "label":"Name", - 'required':true + "required":true }, { "uitype":"int", @@ -95,7 +94,7 @@ "value":12432, "name":"integer", "label":"Integer", - 'required':true + "required":true }, { "uitype":"float", @@ -108,7 +107,7 @@ "uitype":"date", "name":"date", "label":"Date", - 'required':true + "required":true }, { "uitype":"password", @@ -116,7 +115,7 @@ "length":30, "name":"password", "label":"Password", - 'required':true + "required":true }, { "uitype":"checkbox", @@ -125,7 +124,7 @@ "label":"CheckBox", "value":2, "dataurl":"test_code.json", - 'required':true + "required":true }, { "uitype":"code", @@ -133,14 +132,14 @@ "label":"Code", "value":2, "dataurl":"test_code.json", - 'required':true + "required":true }, { "uitype":"text", "name":"text", "value":"This is a test", "label":"Text", - 'required':true + "required":true }, { "uitype":"audiotext", @@ -148,7 +147,7 @@ "name":"atext", "value":"This is a test", "label":"Text", - 'required':true + "required":true } ] } diff --git a/examples/tab.ui b/examples/tab.ui index 6ffedee..a29df93 100644 --- a/examples/tab.ui +++ b/examples/tab.ui @@ -47,9 +47,9 @@ "name":"python", "label":"Python", "content":{ - "widgettype":"Text", + "widgettype":"urlwidget", "options":{ - "text":"This is Python language documents" + "url":"{{entire_url('form.ui')}}" } }, "icon":null