Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
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
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
b1d74460
Commit
b1d74460
authored
Apr 21, 2017
by
baiyaaaaa
Committed by
杨奕
Apr 25, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add disabled feature
parent
5abce7d8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
17 deletions
+38
-17
examples/docs/en-US/upload.md
examples/docs/en-US/upload.md
+1
-0
examples/docs/zh-CN/upload.md
examples/docs/zh-CN/upload.md
+1
-0
packages/upload/src/iframe-upload.vue
packages/upload/src/iframe-upload.vue
+12
-8
packages/upload/src/index.vue
packages/upload/src/index.vue
+3
-1
packages/upload/src/upload-dragger.vue
packages/upload/src/upload-dragger.vue
+13
-4
packages/upload/src/upload.vue
packages/upload/src/upload.vue
+8
-4
No files found.
examples/docs/en-US/upload.md
View file @
b1d74460
...
...
@@ -365,6 +365,7 @@ file-list | default uploaded files, i.e: [{name: 'food.jpeg', url: 'https://fuss
list-type | type of fileList | string | text/picture/picture-card | text |
auto-upload | whether to auto upload file | boolean | — | true |
http-request | override default xhr behavior, allowing you to implement your own upload-file's request | function | — | — |
disabled | whether to disable upload | boolean | — | false |
### Events
| Event Name | Description | Parameters |
...
...
examples/docs/zh-CN/upload.md
View file @
b1d74460
...
...
@@ -414,6 +414,7 @@
| auto-upload | 是否在选取文件后立即进行上传 | boolean | — | true |
| file-list | 上传的文件列表, 例如:
[
{name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}
]
| array | — |
[]
|
| http-request | 覆盖默认的上传行为,可以自定义上传的实现 | function | — | — |
| disabled | 是否禁用 | boolean | — | false |
### Methods
| 方法名 | 说明 | 参数 |
...
...
packages/upload/src/iframe-upload.vue
View file @
b1d74460
...
...
@@ -32,7 +32,8 @@ export default {
default
:
function
()
{}
},
drag
:
Boolean
,
listType
:
String
listType
:
String
,
disabled
:
Boolean
},
data
()
{
...
...
@@ -40,7 +41,7 @@ export default {
mouseover
:
false
,
domain
:
''
,
file
:
null
,
disabled
:
false
submitting
:
false
};
},
...
...
@@ -49,7 +50,9 @@ export default {
return
str
.
indexOf
(
'
image
'
)
!==
-
1
;
},
handleClick
()
{
this
.
$refs
.
input
.
click
();
if
(
!
this
.
disabled
)
{
this
.
$refs
.
input
.
click
();
}
},
handleChange
(
ev
)
{
const
file
=
ev
.
target
.
value
;
...
...
@@ -58,8 +61,8 @@ export default {
}
},
uploadFiles
(
file
)
{
if
(
this
.
disabled
)
return
;
this
.
disabled
=
true
;
if
(
this
.
submitting
)
return
;
this
.
submitting
=
true
;
this
.
file
=
file
;
this
.
onStart
(
file
);
...
...
@@ -103,7 +106,7 @@ export default {
}
else
if
(
response
.
result
===
'
failed
'
)
{
self
.
onError
(
response
,
self
.
file
);
}
self
.
disabled
=
false
;
self
.
submitting
=
false
;
self
.
file
=
null
;
},
false
);
},
...
...
@@ -113,7 +116,8 @@ export default {
drag
,
uploadFiles
,
listType
,
frameName
frameName
,
disabled
}
=
this
;
const
oClass
=
{
'
el-upload
'
:
true
};
oClass
[
`el-upload--
${
listType
}
`
]
=
true
;
...
...
@@ -146,7 +150,7 @@ export default {
<
/form
>
{
drag
?
<
upload
-
dragger
on
-
file
=
{
uploadFiles
}
>
{
this
.
$slots
.
default
}
<
/upload-dragger
>
?
<
upload
-
dragger
on
-
file
=
{
uploadFiles
}
disabled
=
{
disabled
}
>
{
this
.
$slots
.
default
}
<
/upload-dragger
>
:
this
.
$slots
.
default
}
<
/div
>
...
...
packages/upload/src/index.vue
View file @
b1d74460
...
...
@@ -86,7 +86,8 @@ export default {
type
:
String
,
default
:
'
text
'
// text,picture,picture-card
},
httpRequest
:
Function
httpRequest
:
Function
,
disabled
:
Boolean
},
data
()
{
...
...
@@ -227,6 +228,7 @@ export default {
fileList
:
this
.
uploadFiles
,
autoUpload
:
this
.
autoUpload
,
listType
:
this
.
listType
,
disabled
:
this
.
disabled
,
'
on-start
'
:
this
.
handleStart
,
'
on-progress
'
:
this
.
handleProgress
,
'
on-success
'
:
this
.
handleSuccess
,
...
...
packages/upload/src/upload-dragger.vue
View file @
b1d74460
...
...
@@ -5,7 +5,7 @@
'is-dragover': dragover
}"
@drop.prevent="onDrop"
@dragover.prevent="
dragover = true
"
@dragover.prevent="
onDragover
"
@dragleave.prevent="dragover = false"
>
<slot></slot>
...
...
@@ -14,16 +14,25 @@
<
script
>
export
default
{
name
:
'
ElUploadDrag
'
,
props
:
{
disabled
:
Boolean
},
data
()
{
return
{
dragover
:
false
};
},
methods
:
{
onDragover
()
{
if
(
!
this
.
disabled
)
{
this
.
dragover
=
true
;
}
},
onDrop
(
e
)
{
this
.
dragover
=
false
;
this
.
$emit
(
'
file
'
,
e
.
dataTransfer
.
files
);
if
(
!
this
.
disabled
)
{
this
.
dragover
=
false
;
this
.
$emit
(
'
file
'
,
e
.
dataTransfer
.
files
);
}
}
}
};
...
...
packages/upload/src/upload.vue
View file @
b1d74460
...
...
@@ -41,7 +41,8 @@ export default {
httpRequest
:
{
type
:
Function
,
default
:
ajax
}
},
disabled
:
Boolean
},
data
()
{
...
...
@@ -117,7 +118,9 @@ export default {
}
},
handleClick
()
{
this
.
$refs
.
input
.
click
();
if
(
!
this
.
disabled
)
{
this
.
$refs
.
input
.
click
();
}
}
},
...
...
@@ -130,7 +133,8 @@ export default {
multiple
,
accept
,
listType
,
uploadFiles
uploadFiles
,
disabled
}
=
this
;
const
data
=
{
class
:
{
...
...
@@ -145,7 +149,7 @@ export default {
<
div
{...
data
}
>
{
drag
?
<
upload
-
dragger
on
-
file
=
{
uploadFiles
}
>
{
this
.
$slots
.
default
}
<
/upload-dragger
>
?
<
upload
-
dragger
disabled
=
{
disabled
}
on
-
file
=
{
uploadFiles
}
>
{
this
.
$slots
.
default
}
<
/upload-dragger
>
:
this
.
$slots
.
default
}
<
input
class
=
"
el-upload__input
"
type
=
"
file
"
ref
=
"
input
"
name
=
{
name
}
on
-
change
=
{
handleChange
}
multiple
=
{
multiple
}
accept
=
{
accept
}
><
/input
>
...
...
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