Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
apaas-ui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gzga-jzapi
apaas-ui
Commits
aa916a7c
Commit
aa916a7c
authored
May 11, 2020
by
刘殿昕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+拖拽上传功能
parent
7a738e81
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
17 deletions
+38
-17
src/components/upload_file.vue
src/components/upload_file.vue
+28
-16
src/pages/example_upload.vue
src/pages/example_upload.vue
+10
-1
No files found.
src/components/upload_file.vue
View file @
aa916a7c
<
template
>
<
template
>
<div>
<div>
<div
v-if=
"type != 'cropper'"
>
<div
class=
"img_crop"
v-if=
"type == 'cropper'"
>
<div
v-for=
"(item, index) in fileArray"
:key=
"'img' + index"
class=
"list_img"
>
<div
v-if=
"!readOnly"
@
click=
"deleteImg(item, index)"
class=
"list_img_back"
>
<i
class=
"el-icon-delete img_del"
></i>
</div>
<el-image
class=
"list_img_item"
:src=
"item.url"
:fit=
"fit"
></el-image>
</div>
<cropper
v-if=
"fileArray.length
<
=
max
"
@
getNewUrl=
"getNewUrl"
></cropper>
</div>
<div
v-else
>
<el-upload
<el-upload
action=
"ssurl"
action=
"ssurl"
:file-list=
"fileArray"
:file-list=
"fileArray"
...
@@ -13,20 +22,19 @@
...
@@ -13,20 +22,19 @@
:class=
"
{hide:hideUpload || readOnly}"
:class=
"
{hide:hideUpload || readOnly}"
:readOnly="readOnly"
:readOnly="readOnly"
:data="anotherData"
:data="anotherData"
:drag="drag"
>
>
<el-button
size=
"small"
type=
"primary"
v-if=
"type=='mp3'"
>
上传文件
</el-button>
<div
v-if=
"drag"
>
<div
slot=
"tip"
class=
"el-upload__tip"
v-if=
"type=='mp3'"
>
支持文件格式:.mp3,单个文件不能超过20M。
</div>
<i
class=
"el-icon-upload"
></i>
<i
class=
"el-icon-plus"
v-if=
"type=='picture'"
></i>
<div
class=
"el-upload__text"
>
</el-upload>
将文件拖到此处,或
<em>
点击上传
</em>
</div>
</div>
<div
class=
"img_crop"
v-else
>
<div
v-for=
"(item, index) in fileArray"
:key=
"'img' + index"
class=
"list_img"
>
<div
v-if=
"!readOnly"
@
click=
"deleteImg(item, index)"
class=
"list_img_back"
>
<i
class=
"el-icon-delete img_del"
></i>
</div>
</div>
<el-image
class=
"list_img_item"
:src=
"item.url"
:fit=
"fit"
></el-image>
<el-button
size=
"small"
type=
"primary"
v-if=
"!drag && type=='default'"
>
上传文件
</el-button>
</div>
<div
slot=
"tip"
class=
"el-upload__tip"
v-if=
"!drag && type=='mp3'"
>
支持文件格式:.mp3,单个文件不能超过20M。
</div>
<cropper
v-if=
"fileArray.length
<
=
max
"
@
getNewUrl=
"getNewUrl"
></cropper>
<i
class=
"el-icon-plus"
v-if=
"!drag && type=='picture'"
></i>
</el-upload>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
...
@@ -55,7 +63,7 @@ export default {
...
@@ -55,7 +63,7 @@ export default {
},
},
list
:
{
list
:
{
type
:
Array
,
type
:
Array
,
default
:
[]
default
:
()
=>
[]
},
},
type
:
{
type
:
{
type
:
String
,
type
:
String
,
...
@@ -68,6 +76,10 @@ export default {
...
@@ -68,6 +76,10 @@ export default {
fit
:
{
fit
:
{
type
:
String
,
type
:
String
,
default
:
""
default
:
""
},
drag
:
{
type
:
Boolean
,
default
:
false
}
}
},
},
watch
:
{
watch
:
{
...
@@ -131,8 +143,8 @@ export default {
...
@@ -131,8 +143,8 @@ export default {
this
.
hideUpload
=
fileList
.
length
>=
this
.
max
;
this
.
hideUpload
=
fileList
.
length
>=
this
.
max
;
},
},
handleRemove
(
file
,
fileList
)
{
handleRemove
(
file
,
fileList
)
{
if
(
!
(
fileList
&&
fileList
.
length
>
0
))
{
if
(
!
(
fileList
&&
fileList
.
length
>
0
))
{
return
return
;
}
}
let
url
=
file
.
url
;
let
url
=
file
.
url
;
let
detection
=
true
;
let
detection
=
true
;
...
...
src/pages/example_upload.vue
View file @
aa916a7c
<
template
>
<
template
>
<div
class=
"up_ex_container"
>
<div
class=
"up_ex_container"
>
<h3>
压缩包上传
</h3>
<upload-file
:multiple=
"false"
:max=
"1"
type=
"zip"
:readOnly=
"false"
:drag=
"true"
@
getNewList=
"getNewList"
></upload-file>
<h3>
带有裁剪功能的图片上传
</h3>
<h3>
带有裁剪功能的图片上传
</h3>
<upload-file
<upload-file
:multiple=
"false"
:multiple=
"false"
...
@@ -23,7 +32,7 @@
...
@@ -23,7 +32,7 @@
<upload-file
<upload-file
:multiple=
"false"
:multiple=
"false"
:max=
"4"
:max=
"4"
type=
"
mp3
"
type=
"
default
"
:readOnly=
"false"
:readOnly=
"false"
fit=
"fill"
fit=
"fill"
:list=
"imgList"
:list=
"imgList"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment