如何让Button使用自定义icon

1.在Buttton所在的html页面定义button要使用的icon的css样式,如

 1 </style>
 2 <style>
 3     .dijitArrowIcon {
 4         background-image: url('../css/images/arrowIconEnabled.png');
 5         background-repeat: no-repeat;
 6         width: 18px;
 7         height: 18px;
 8         text-align: center;
 9     }
10     .dijitRightPink { background-position: 0; }
11     .dijitRightOrange { background-position: -18px; }
12 </style>

2. 在页面定义button

<button id="testBtn">Test</button>

3. 在js文件中创建该button

1 var testBtn = new Button({
2     iconClass: "dijitArrowIcon dijitRightOrange"
3 }, "testBtn");
原文地址:https://www.cnblogs.com/captain-cp/p/5042867.html