3

我正在使用带有 Jquery UI 的 jquery fileupload 插件

https://github.com/blueimp/jQuery-File-Upload/wiki/Options

我想覆盖小部件选项,例如maxUploadfilesize

当前,如果我覆盖了主文件中的设置 jquery.fileupload-ui.js

然后它工作

var parentWidget = ($.blueimpFP || $.blueimp).fileupload;
    $.widget('blueimpUI.fileupload', parentWidget, {

        options: {
            // By default, files added to the widget are uploaded as soon
            // as the user clicks on the start buttons. To enable automatic
            // uploads, set the following option to true:
            autoUpload: true,
            //sequentialUploads, true,
            // The following option limits the number of files that are
            // allowed to be uploaded using this widget:
            maxNumberOfFiles: undefined,
            // The maximum allowed file size:
            maxFileSize: 20000000,
            // The minimum allowed file size:
            minFileSize: undefined,

有什么办法可以在我的 html 模板中覆盖它,以便我可以对不同的 html 页面进行不同的自定义

我的意思是一些 javvscript 代码,我可以将其放入覆盖默认设置的模板中

4

1 回答 1

2

他们的文档说您可以覆盖它们

只需将此代码放在您初始化插件的位置

$('#fileupload').fileupload(
    'option',
    {
        maxFileSize: 4000000,
        sequentialUploads: true
    }
);
于 2012-12-10T04:09:11.960 回答