现在的位置: 首页 > 综合 > 正文

\t\text iconCls: 简单用法

2014年07月16日 ⁄ 综合 ⁄ 共 950字 ⁄ 字号 评论关闭

今天学习ext 看examples中的事例,其中有一个地方是这样写的:

new ButtonPanel(
            'Icon Only',
            [{
                iconCls: 'add16'
            },{
                iconCls: 'add24',
                scale: 'medium'
            },{
                iconCls: 'add',

                scale: 'large'
            }]
        );

例子的效果是:

  ext  iconCls: 简单用法 - xiaojunwei1987 - http://hi.baidu.com/
看了半天没有明白iconCls后面的add16 ,add24是什么意思。后来看到buttons.css 终于明白了应该是图片样式的意思,既是CSS里面定义的class。

后来看了看API,里面也是这么写的。遇到什么问题还是多看API。

iconCls : String

用来指定背景图片的样式类。A css class which sets a background image to be used as the icon for this button

/*!
* Ext JS Library 3.2.1
* Copyright(c) 2006-2010 Ext JS, Inc.
* licensing@extjs.com
* http://www.extjs.com/license
*/
.add {
    background-image: url(images/add.gif) !important;
}
.add16 {
    background-image: url(images/add16.gif) !important;
}
.add24 {
    background-image: url(images/add24.gif) !important;
}

.btn-panel td {
    padding-left:5px;
}

h2 {
    color:#083772 !important;
    margin: 20px 0 0 !important;
    padding: 5px;
    background:#eee;
    width:400px;
}

h3 {
    font-weight:normal !important;
}

抱歉!评论已关闭.