我使用dropzone进行多个文件上传,这里我遇到了一个奇怪的问题,我在下面给出了我的代码。
<script type="text/javascript" src="<?php echo $this->webroot?>js/jquery-1.7.2.min.js"></script>
<link rel="stylesheet" href="<?php echo $this->webroot?>css/popup_style.css" type="text/css"/>
<link rel="stylesheet" href="<?php echo $this->webroot;?>css/dropzone.css" />
<script src="<?php echo $this->webroot;?>js/dropzone.min.js"></script>
<script type="text/javascript">
jQuery(function($){
try {
jQuery(".dropzone").dropzone({
paramName: "file", // The name that will be used to transfer the file
maxFilesize: 10, // MB
maxFiles: 6,
//autoProcessQueue: true,
addRemoveLinks : true,
acceptedFiles: ".jpeg,.jpg,.png,.gif,.JPEG,.JPG,.PNG,.GIF",
dictDefaultMessage :
'<span class="bigger-150 bolder"><i class="icon-caret-right red"></i> Drop files</span> to upload \
<span class="smaller-80 grey">(or click)</span> <br /> \
<i class="upload-icon icon-cloud-upload blue icon-3x"></i>',
dictResponseError: 'Error while uploading file!',
//change the previewTemplate to use Bootstrap progress bars
previewTemplate: "<div class=\"dz-preview dz-file-preview\">\n <div class=\"dz-details\">\n <div class=\"dz-filename\"><span data-dz-name></span></div>\n <div class=\"dz-size\" data-dz-size></div>\n <img data-dz-thumbnail />\n </div>\n <div class=\"progress progress-small progress-success progress-striped active\"><span class=\"bar\" data-dz-uploadprogress></span></div>\n <div class=\"dz-success-mark\"><span></span></div>\n <div class=\"dz-error-mark\"><span></span></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n</div>"
});
} catch(e) {
alert('Dropzone.js does not support older browsers!');
}
});
</script>
<body style="margin:0px;">
<div class="popup">
<div class="popHead">
<!--<a href="#" class="popCross"></a>-->
<div class="clear"></div>
</div>
<div class="popBody">
<div id="dropzone">
<form action="<?php echo $this->webroot;?>manage/multiple_latest_experience_upload" class="dropzone">
<div class="fallback">
<input name="photo" id="photo" type="file" multiple="" />
</div>
</form>
</div>
</div>
</div>
</body>
现在的问题是,如果我使用,
<script type="text/javascript" src="<?php echo $this->webroot?>js/jquery-1.7.2.min.js"></script>
然后属性“maxFiles”,“acceptedFiles”正常工作但进度条没有到来。
如果我删除了,
<script type="text/javascript" src="<?php echo $this->webroot?>js/jquery-1.7.2.min.js"></script>
JS库然后属性“maxFiles”,“acceptedFiles”无效但进度条即将到来。当此页面加载到fancybox中时,会显示JavaScript错误“错误:Dropzone已附加。”。我不明白如何解决这个问题。
答案 0 :(得分:0)
尝试下面的代码:
'use strict';
import React from 'react';
import ReactDOM from 'react-dom';
import Logo from './components/Logo';
ReactDOM.render(
<h1>
Welcome to the app!
</h1>,
document.getElementById('app')
);
答案 1 :(得分:-1)
我怀疑您使用的版本jquery太旧了。试试1.10.2