fastadmin 开关

1 mysql

 

2 js

{field: 'switch', title: __('Switch'), searchList: {"1":__('Yes'),"0":__('No')}, table: table, formatter: Table.api.formatter.toggle}

3 add.html

<div class="form-group">
    <label class="control-label col-xs-12 col-sm-2">{:__('Switch')}:</label>
    <div class="col-xs-12 col-sm-8">
        <input  id="c-switch" name="row[switch]" type="hidden" value="0">
        <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-switch" data-yes="1" data-no="0" >
            <i class="fa fa-toggle-on text-success fa-flip-horizontal text-gray fa-2x"></i>
        </a>
    </div>
</div>

4 edit.html

<div class="form-group">

    <label class="control-label col-xs-12 col-sm-2">{:__('Switch')}:</label>

    <div class="col-xs-12 col-sm-8">

        <input  id="c-switch" name="row[switch]" type="hidden" value="{$row.switch}">

        <a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-switch" data-yes="1" data-no="0" >

            <i class="fa fa-toggle-on text-success {eq name="$row.switch" value="0"}fa-flip-horizontal text-gray{/eq} fa-2x"></i>

        </a>

    </div>

</div>

 

posted @ 2020-07-13 15:16  CanyingV  阅读(536)  评论(0编辑  收藏  举报