fastadmin自定义页面,点击上传按钮,无法触发上传的事件解决

使用官方的命令行生成curd表单可正常使用上传组件,但是自定义页面没有办法调起上传事件,本文讲解怎么解决此问题
fastadmin一个php控制器对应一个js文件

php方法
    //对比订单
    public function compare_order()
    {
        return $this->view->fetch();
    }
html
<form id="first-form" role="form" data-toggle="validator" method="POST" action="">
    <div class="form-group row">
        <label class="control-label col-xs-12 col-sm-2">{:__('上传文件')}:label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-files" data-rule="required" class="form-control" size="50" name="row[files]" type="text" value="">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="plupload-files" class="btn btn-danger plupload" data-input-id="c-files" data-mimetype="*" data-multiple="true" data-preview-id="p-files"><i class="fa fa-upload">i> {:__('Upload')}button>span>
                    <span><button type="button" id="fachoose-files" class="btn btn-primary fachoose" data-input-id="c-files" data-mimetype="*" data-multiple="true"><i class="fa fa-list">i> {:__('Choose')}button>span>
                div>
                <span class="msg-box n-right" for="c-files">span>
            div>
        div>
    div>

    <div class="form-group row">
        <label class="control-label col-xs-12 col-sm-2">label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed">{:__('OK')}button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}button>
        div>
    div>
form>
js
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
    var Controller = {
        update_order: function () {

        },
        upload_call: function () {

        },
        compare_order: function () {
        	//只需要添加这行代码,就可调用上传组件
            require(['upload'], function(Upload){
                Upload.api.plupload();
            });
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});

核心代码
require(['upload'], function(Upload){
   Upload.api.plupload();
});

你可能感兴趣的:(PHP,Web前端,bootstrap,php,前端)