This commit is contained in:
yumoqing 2024-02-28 14:11:42 +08:00
parent 638e629cf1
commit e1cf723dee
2 changed files with 6 additions and 7 deletions

View File

@ -90,8 +90,8 @@ bricks.widgetBuild = async function(desc, widget){
console.log('widgetBuild():',desc.widgettype, 'not registered', bricks.Factory.widgets_kw);
return null;
}
desc.options.baseURI = base_url;
var options = desc.options || {};
options.baseURI = base_url;
let w = new klass(options);
if (desc.id){
w.set_id(desc.id);

View File

@ -7,17 +7,16 @@ bricks.Layout = class extends bricks.JsWidget {
}
add_widget(w, index){
if (! index || index>=this.children.length){
if (index >=0 && index < this.children.length){
var pos_w = this.children[index];
this.dom_element.insertBefore(w.dom_element, pos_w.dom_element);
this.children.insert(index+1, w);
} else {
// append child at end
w.parent = this;
this.children.push(w);
this.dom_element.appendChild(w.dom_element);
return
}
// insert to where index point out
var pos_w = this.children[index];
this.dom_element.insertBefore(w.dom_element, pos_w.dom_element);
this.children.insert(index+1, w);
w.dispatch('on_parent', this);
}
remove_widgets_at_begin(cnt){