bugfix
This commit is contained in:
parent
bba72ea544
commit
576ca6b4b1
@ -12,7 +12,7 @@ bricks.Menu = class extends bricks.VBox {
|
||||
this.dom_element.style.display = "";
|
||||
this.dom_element.style.backgroundColor = options.bgcolor || "white";
|
||||
this.create_children(this, this.opts.items);
|
||||
this.bind('click', this.menu_clicked);
|
||||
this.bind('click', this.menu_clicked.bind(this));
|
||||
}
|
||||
create_submenu_container(){
|
||||
let cp = new bricks.VBox({});
|
||||
@ -22,11 +22,12 @@ bricks.Menu = class extends bricks.VBox {
|
||||
}
|
||||
async menu_clicked(event){
|
||||
let e = event.target;
|
||||
var item = e.bricks_widget;
|
||||
console.log('menu_clicked(): item=', item, item.opts, item.url);
|
||||
if (!item.url){
|
||||
let opts = event.params.opts;
|
||||
var menu = e.bricks_widget;
|
||||
console.log('menu_clicked(): item=', item, item.opts, opts);
|
||||
if (! opts.url){
|
||||
console.log('itme.url is null');
|
||||
this.dispatch('command', item.opts);
|
||||
this.dispatch('command', opts);
|
||||
return;
|
||||
}
|
||||
var t = bricks.getWidgetById(this.target);
|
||||
@ -34,7 +35,7 @@ bricks.Menu = class extends bricks.VBox {
|
||||
var desc = {
|
||||
"widgettype":"urlwidget",
|
||||
"options":{
|
||||
"url":item.url
|
||||
"url":opts.url
|
||||
}
|
||||
}
|
||||
var w = await bricks.widgetBuild(desc, this);
|
||||
@ -97,7 +98,7 @@ bricks.Menu = class extends bricks.VBox {
|
||||
}
|
||||
regen_menuitem_event(item, event){
|
||||
console.log('regen_menuitem_event()', item);
|
||||
item.dispatch('click', item);
|
||||
this.dispatch('click', item);
|
||||
event.stopPropagation();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user