前端之家收集整理的这篇文章主要介绍了
dojo Menu,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
<!DOCTYPE html>
<html>
<head>
<Meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Dojo Button Widget Test</title>
<link id="themeStyles" rel="stylesheet" href="../../scripts/dijit/themes/claro/claro.css">
<script type="text/javascript" src="../../scripts/dojo/dojo.js" djConfig="parSEOnLoad: true"></script>
<script type="text/javascript">
dojo.require("dijit.dijit"); // optimize: load dijit layer
dojo.require("dijit.Menu");
dojo.require("dijit.form.Button");
dojo.require("dojo.parser");
dojo.ready(function(){
var myMenu = new dijit.Menu();
var mItemA = new dijit.MenuItem({lable:"mItemA",iconClass:"",onClick:function(){ console.log("not actually saving anything,just a test!"); }});
myMenu.addChild(mItemA);
console.dir(mItemA);
var button1 = new dijit.form.ComboButton({label: "hello world",dropDown : myMenu,dropDownPosition:["above"],optionsTitle:"save options",onClick:function(){alert("clicked combo save"); },iconClass:"plusBlockIcon"});
dojo.body().appendChild(button1.domNode);
var mItemB = new dijit.MenuItem({lable:"mItemA",just a test!"); }});
myMenu.addChild(mItemB);
})
</script>
</head>
<body class="claro" style="padding-top:100px">
<button id="combo_above" data-dojo-type="dijit.form.ComboButton" data-dojo-props='dropDownPosition:["above"],onClick:function(){ console.log("clicked combo save"); },iconClass:"plusBlockIcon"'>
<span>Up</span>
<span data-dojo-type="dijit.Menu">
<span data-dojo-type="dijit.MenuItem" data-dojo-props='iconClass:"dijitEditorIcon dijitEditorIconSave",just a test!"); }'>Save</span>
<span data-dojo-type="dijit.MenuItem"
data-dojo-props='onClick:function(){ console.log("not actually saving anything,just a test!"); }'>Save As</span>
</span>
</button>
</body>
</html>
原文链接:https://www.f2er.com/dojo/291687.html