easyui-menu

来源:互联网 发布:厨房用品知乎 编辑:程序博客网 时间:2024/06/08 05:43

单属性,有些设置在 data-options 有效

$('#box').menu({
left:100,
top:100,
hideOnUnhover:true,
zIndex:100,
onShow:function(){
alert('显示时触发');
},
onHide:function(){
alert('隐藏时触发');
},
onClick:function(item){
alert(item.text);
},
});

//返回属性对象 console.log($('#box').menu('options'));

 

//显示菜单 $('#box').menu('show', {

 

left : e.pageX, top : e.pageY,

});

 

//隐藏菜单 $('#box').menu('hide');

 

//销毁菜单 $('#box').menu('destroy');

 

//得到某个菜单项对象 console.log($('#box').menu('getItem', '#new'));

 

//设置某个菜单项文本 $('#box').menu('setText', {

 

target : '#new', text : '修改',

});


 

//设置某个菜单项图标 $('#box').menu('setIcon', {

 

target : '#new', iconCls : 'icon-add',

});

 

//通过文本获取指定的菜单项对象 console.log($('#box').menu('findItem','新建'));

 

//追加一个顶层菜单项 $('#box').menu('appendItem', {

 

text : '新增', iconCls : 'icon-add',

 

onclick : function () { alert('新增');

 

},

 

});

 

//追加一个子菜单项 $('#box').menu('appendItem', {

 

parent : $('#box').menu('findItem', '打开').target, text : '新增',

 

iconCls : 'icon-add', onclick : function () {

alert('新增');

 

},

 

});

 

//移出指定菜单项 $('#box').menu('removeItem', '#new');

 

//禁用指定菜单项 $('#box').menu('disableItem', '#new');

 

//启用指定菜单项 $('#box').menu('enableItem', '#new');

 




0 0
原创粉丝点击