FastAdmin自定义按钮触发弹窗

1.在html中写一个按钮:

{:__('All_pass')}

2.在js头部定义一个template:

define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function ($, undefined, Backend, Table, Form, Template)

3.在js中写一个事件:

        index: function () {
            var table = $("#table");
            // 为表格绑定事件
            Table.api.bindevent(table);

            //标记为全部通过
            $(document).on('click','.btn-all-pass',function () {
                var ids = Table.api.selectedids(table);
                Layer.open({
                    title: __('Warning'),
                    content: Template("tpl-all-pass", {}),
                    btn: [__('OK'),__('Cancel')],
                    yes: function (index,layero) {
                        Fast.api.ajax({
                            url: "ykvr/video/video/check/ids/" + ids.join(","),
                            type: "post",
                            data: {state: 1},
                        }, function () {
                            table.bootstrapTable('refresh', {});
                            Layer.close(index);
                        });
                    },success: function (layero, index) {
                    }
                });
            });

4.在html中写入弹窗的内容:

        

你可能感兴趣的:(FastAdmin自定义按钮触发弹窗)