首先,form表单需要具有如下代码
<form class="form-horizontal" role="form" method="POST" action=""> <input id="c-image" class="form-control" size="50" name="row[image]" type="text" value=""> <span> <button type="button" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"> <i class="fa fa-upload"></i> 上传 </button> </span> <ul class="row list-inline plupload-preview" id="p-image"></ul> </form>
js文件需要
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { } }; Form.api.bindevent($("form[role=form]")); return Controller; });