Skip to content

Commit

Permalink
Merge pull request #538 from dragonwong/master
Browse files Browse the repository at this point in the history
更新 uploader
  • Loading branch information
RubyLouvre committed Feb 28, 2015
2 parents b9e19e1 + 8269e20 commit 3877620
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
8 changes: 6 additions & 2 deletions uploader/avalon.uploader.doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ <h2>uploader</h2>
<li><a href="avalon.uploader.ex2.html">各种回调</a></li>
</ul>
</fieldset>
<fieldset>
<legend>注意</legend>
<p>在初始化时,请不要使用 <code>display: none</code> 来隐藏上传按钮,这样会导致 flash 文件无法加载。</p>
</fieldset>
<fieldset>
<legend>日志</legend>
<ul>
Expand All @@ -144,8 +148,8 @@ <h2>uploader</h2>
<fieldset>
<legend>计划</legend>
<ul>
<li>这个组件仍处于在开发阶段,而且缺少实际应用的经验,所以我们期待各种 issue</li>
<li>未来会依赖于一个更加强大的 flash,而在使用高级浏览器时则会使用 html5 来实现</li>
<li>在高级浏览器时使用 html5 来实现</li>
<li>一个新的支持包括图片在内各种文件的上传组件正在开发中</li>
</ul>
</fieldset>
</div>
Expand Down
26 changes: 15 additions & 11 deletions uploader/avalon.uploader.ex1.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@
}
.weibo .add:hover{
border-color: #FFA306;
}
.weibo .add.hidden{
visibility: hidden;
position: absolute;
}
.weibo .add .icon-add{
font-size: 40px;
Expand All @@ -100,7 +104,7 @@ <h2>概览</h2>
<fieldset class="default">
<legend>多图片上传</legend>
<div ms-widget="uploader, $, $opts">

<p>共{{files.length}}张,还能上传{{maxFileCount - files.length}}张</p>

<ul class="preview">
Expand All @@ -110,7 +114,7 @@ <h2>概览</h2>
</ul>

<p><div id="browse-btn" class="add" ms-class="disabled: files.length >= maxFileCount">上传图片</div></p>


<table class="info">
<caption>图片信息</caption>
Expand Down Expand Up @@ -142,7 +146,7 @@ <h2>概览</h2>
<ul class="preview">
<li ms-repeat="files" ms-click="deleteFile($index)" ms-css-background-image="'url(' + el.src + ')'" ms-css-filter="'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=' + el.src + ', sizingMethod=scale)'"></li>
</ul>
<span id="browse-btn-2" class="add" ms-visible="files.length < maxFileCount">
<span id="browse-btn-2" class="add" ms-class="hidden: files.length >= maxFileCount">
<span class="icon-add">&#10010;</span>
</span>
</div>
Expand All @@ -152,27 +156,27 @@ <h2>概览</h2>
</fieldset>

<script>
require(["uploader/avalon.uploader", "ready!"], function(){
var model = avalon.define("demo", function(vm){

vm.$opts = {
require(["uploader/avalon.uploader", "domReady!"], function(){
var model = avalon.define({
$id: "demo",
$opts: {
action: 'post.php',
browseButton: 'browse-btn',
maxFileCount: 4,
maxFileSize: 1048576000,
onFileSizeErr: function(fileName){
alert('自定义信息:' + fileName + '大小超过1M啦~')
}
};
vm.$opts_2 = {
},
$opts_2: {
action: 'post.php',
browseButton: 'browse-btn-2',
maxFileCount: 4,
maxFileSize: 1048576000,
onFileSizeErr: function(fileName){
onFileSizeErr: function(fileName) {
alert('自定义信息:' + fileName + '大小超过1M啦~')
}
};
}
});
avalon.scan();
});
Expand Down
11 changes: 5 additions & 6 deletions uploader/avalon.uploader.ex2.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ <h2>回调</h2>
</fieldset>

<script>
require(["uploader/avalon.uploader", "ready!"], function(){
var model = avalon.define("demo", function(vm){

vm.$opts = {
require(["uploader/avalon.uploader", "domReady!"], function(){
var model = avalon.define({
$id: "demo",
$opts: {
action: 'post.php',
browseButton: 'browse-btn',
maxFileCount: 4,
Expand All @@ -124,8 +124,7 @@ <h2>回调</h2>
onDeleteFailed: function(data){
avalon.log('删除失败!');
}
};

}
});
avalon.scan();
});
Expand Down

0 comments on commit 3877620

Please sign in to comment.