EasyUI系列学习(七)-Linkbutton(按钮)

一、加载组件

1.使用class加载

<a href="#" class="easyui-linkbutton">按钮</a>

2.使用js加载

<a href="#" id="btn"></a>
<script>
    $(function () {
        $("#btn").linkbutton({
            text: "按钮"
        });
    })
</script>

二、属性

1.id,disabled,text,iconCls,iconAlign,plain

<a href="#" id="btn"></a>
<script>
    $(function () {
        $("#btn").linkbutton({
            //默认为null
          id: "pox",
            //为true时禁用按钮
            disabled: true,
            //按钮文字
            text: "按钮",
            //按钮图标,css类的id
           iconCls: "icon-add",
            //图标在文字的右侧(left,right)
            iconAlign: "right",
            //为true时,显示简洁效果
            plain: true
        });
    })
</script>

生成的html

<a id="pox" class="l-btn l-btn-small l-btn-plain l-btn-disabled l-btn-plain-disabled" href="javascript:void(0)" group="">
    <span class="l-btn-left l-btn-icon-right">
        <span class="l-btn-text">按钮</span>
        <span class="l-btn-icon icon-add"> </span>
    </span>
</a>

2.toggle:设置true则运行用户切换气状态是否被选中,可实现checkbox复选功能效果,默认为false

<a href="#" id="btn1">C#</a>
<a href="#" id="btn2">Java</a>
<script>
    $(function () {
        $("#btn1").linkbutton({
            toggle: true
        });
        $("#btn2").linkbutton({
            toggle: true
        });
    })
</script>

3.group:指定相同组名的按钮同属于一个组,可实现radio单选效果

<a href="#" id="btn1"></a>
<a href="#" id="btn2"></a>
<script>
    $(function () {
        $("#btn1").linkbutton({
            toggle: true,
            group: "sex"
        });
        $("#btn2").linkbutton({
            toggle: true,
            group: "sex"
        });
    })
</script>

4.selected:定义按钮的选中状态

三、方法

1.options:

<a href="#" id="btn"></a>
<script>
    $(function () {
        $("#btn").linkbutton({
           
        });
        console.log($("#btn").linkbutton("options"));
    })
</script>

输出的内容如下

image

2.disable

3.enable

四、设置默认值

$.fn.linkbutton.defaults.plain = true;

转载于:https://www.cnblogs.com/kimisme/p/5202087.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值