Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
finance-manage
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
finance-oa
finance-manage
Commits
566053da
Commit
566053da
authored
Nov 16, 2020
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增图片上传组件
parent
0ef00724
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
0 deletions
+68
-0
ruoyi-ui/src/components/UploadImage/index.vue
ruoyi-ui/src/components/UploadImage/index.vue
+68
-0
No files found.
ruoyi-ui/src/components/UploadImage/index.vue
0 → 100644
View file @
566053da
<
template
>
<div
class=
"component-upload-image"
>
<el-upload
:action=
"uploadImgUrl"
list-type=
"picture-card"
:on-success=
"handleUploadSuccess"
:before-upload=
"handleBeforeUpload"
:on-error=
"handleUploadError"
name=
"file"
:show-file-list=
"false"
:headers=
"headers"
style=
"display: inline-block; vertical-align: top"
>
<img
v-if=
"value"
:src=
"value"
class=
"avatar"
/>
<i
v-else
class=
"el-icon-plus avatar-uploader-icon"
></i>
</el-upload>
</div>
</
template
>
<
script
>
import
{
getToken
}
from
"
@/utils/auth
"
;
export
default
{
components
:
{},
data
()
{
return
{
uploadImgUrl
:
process
.
env
.
VUE_APP_BASE_API
+
"
/common/upload
"
,
// 上传的图片服务器地址
headers
:
{
Authorization
:
"
Bearer
"
+
getToken
(),
},
};
},
props
:
{
value
:
{
type
:
String
,
default
:
""
,
},
},
methods
:
{
handleUploadSuccess
(
res
)
{
this
.
$emit
(
"
input
"
,
res
.
url
);
this
.
loading
.
close
();
},
handleBeforeUpload
()
{
this
.
loading
=
this
.
$loading
({
lock
:
true
,
text
:
"
上传中
"
,
background
:
"
rgba(0, 0, 0, 0.7)
"
,
});
},
handleUploadError
()
{
this
.
$message
({
type
:
"
error
"
,
message
:
"
上传失败
"
,
});
this
.
loading
.
close
();
},
},
watch
:
{},
};
</
script
>
<
style
scoped
lang=
"scss"
>
.avatar
{
width
:
100%
;
height
:
100%
;
}
</
style
>
\ No newline at end of file
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