0
A
回答
0
这是从dojo工具包网站上的教程中提取的示例。 它创建一个带有新任务图标的按钮,并且没有文本。
<script>
require(["dijit/form/Button", "dojo/domReady!"], function(Button) {
var button2 = new Button({
iconClass: "dijitEditorIcon",
showLabel: false,
label: "Click Me!", // analogous to title when showLabel is false
onClick: function(){ console.log("Second button was clicked!"); }
}, "btn2");
button2.startup();
});
</script>
你感兴趣的是showLabel: false
其中隐藏的文本,iconClass: "dijitEditorIcon"
其中一位表示在CSS
定义为了增加自己的“图标”的图标,请检查下面的CSS :
.dijitEditorIcon {
background-image: url('images/editorIconsEnabled.png');
background-repeat: no-repeat;
width: 18px;
height: 18px;
text-align: center;
}
本质上讲,你创建CSS类与背景图像,那么您应用的造型给您道场通过“iconClass
”属性按钮。
0
如果我想补充,你可以声明使用这个(和这些例子使用的dijit的默认图标):
<button id="insertNewItem" data-dojo-type="dijit/form/Button" data-dojo-props="iconClass: 'dijitIconNewTask'" type="button"> Insert </button>
<button id="updateSelectedItem" data-dojo-type="dijit/form/Button" data-dojo-props="iconClass: 'dijitIconEdit'" type="button"> Update </button>
<button id="deleteSelectedItem" data-dojo-type="dijit/form/Button" data-dojo-props="iconClass: 'dijitIconDelete'" type="button"> Delete </button>
相关问题
- 1. 添加图像到按钮
- 2. C#/ XAML将图像添加到按钮
- 3. Android将图像添加到按钮
- 4. 将图像添加到按钮
- 5. 将图像添加到jQuery按钮
- 6. Blackberry - 将图像添加到按钮?
- 7. 不能将图像添加到按钮
- 8. 如何将图像添加到按钮?
- 9. 将图像按钮添加到gridview行
- 10. 如何将图标添加到Xpages中的dojo按钮?
- 11. 将侧按钮图像添加到按钮
- 12. 将“添加另一个精选图像”按钮添加到WordPress
- 13. Dojo DGrid-如何将按钮添加到列标签中?
- 14. 如何将多个按钮添加到dojo网格单元
- 15. 如何将图像或图标添加到按钮
- 16. 将图像添加到列表视图中的按钮
- 17. 将图像添加到其他视图中的按钮
- 18. 将图标添加到输入按钮
- 19. 将图片添加到按钮
- 20. 将按钮添加到树视图行
- 21. 将图标按钮添加到TinyMCE(Plone)
- 22. 将图标添加到按钮
- 23. 将引导图标添加到按钮
- 24. 将图片添加到Facebook Like按钮
- 25. 将图标添加到jQuery按钮
- 26. 将按钮添加到图表 - svg
- 27. 添加/删除按钮按下图像
- 28. 将标签添加到dojo饼图
- 29. 将按钮添加到jtable
- 30. 将按钮添加到UITableView
我想'.dijitEditorIcon'应该是'.dijitIconNewTask' – g00glen00b
@ g00glen00b如果你想一个复制+粘贴工作的例子,是的。我已经更新了答案 – Sk93