Fork me on github

bootstrap-switch

<input type="checkbox" name="switch" />
    <!-- <input type="checkbox" name="switch" checked/> 默认启动 -->
 <link href="https://cdn.bootcss.com/bootstrap-switch/4.0.0-alpha.1/css/bootstrap-switch.min.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://cdn.bootcss.com/bootstrap-switch/4.0.0-alpha.1/js/bootstrap-switch.min.js"></script>
    $('[name="switch"]').bootstrapSwitch({
                onText: "是",
                offText: "否",
                onColor: "success",
                offColor: "info",
                size: "small",
               // handleWidth: "30"
            })

js修改状态

 $(this).bootstrapSwitch('state', data.cameras[index].isEnable == 1 ? true : false)

 

posted @ 2022-12-26 09:45  我の前端日记  阅读(341)  评论(0)    收藏  举报
Copyright © 2021 LinCangHai
Powered by .NET 5.0 on Kubernetes