Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VueElementTemplate
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄瑜
VueElementTemplate
Commits
b2af2ddf
Commit
b2af2ddf
authored
Apr 28, 2017
by
Pan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refine avatarUpload demo
parent
dfd7ce8d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
index.vue
src/components/ImageCropper/index.vue
+1
-1
avatarUpload.vue
src/views/components/avatarUpload.vue
+6
-5
No files found.
src/components/ImageCropper/index.vue
View file @
b2af2ddf
...
@@ -694,7 +694,7 @@
...
@@ -694,7 +694,7 @@
// 上传成功
// 上传成功
function
(
resData
)
{
function
(
resData
)
{
that
.
loading
=
2
;
that
.
loading
=
2
;
that
.
$emit
(
'crop-upload-success'
,
url
);
that
.
$emit
(
'crop-upload-success'
,
resData
);
},
},
// 上传失败
// 上传失败
function
(
sts
)
{
function
(
sts
)
{
...
...
src/views/components/avatarUpload.vue
View file @
b2af2ddf
...
@@ -4,13 +4,12 @@
...
@@ -4,13 +4,12 @@
由于我在使用时它只有vue@1版本,而且有些业务的需求耦合到七牛等等原因吧,自己改造了一下,如果大家要使用的话,优先还是使用官方component
由于我在使用时它只有vue@1版本,而且有些业务的需求耦合到七牛等等原因吧,自己改造了一下,如果大家要使用的话,优先还是使用官方component
</code>
</code>
<PanThumb
image=
'https://wpimg.wallstcn.com/577965b9-bb9e-4e02-9f0c-095b41417191
'
>
<PanThumb
:image=
'image
'
>
</PanThumb>
</PanThumb>
<el-button
type=
"primary"
icon=
"upload"
style=
"position: absolute;bottom: 15px;margin-left: 40px;"
@
click=
"imagecropperShow=true"
>
修改头像
<el-button
type=
"primary"
icon=
"upload"
style=
"position: absolute;bottom: 15px;margin-left: 40px;"
@
click=
"imagecropperShow=true"
>
修改头像
</el-button>
</el-button>
<ImageCropper
:width=
"300"
:height=
"300"
url=
"https://httpbin.org/post"
@
crop-upload-success=
"cropSuccess"
:key=
"imagecropperKey"
<ImageCropper
:width=
"300"
:height=
"300"
url=
"https://httpbin.org/post"
@
crop-upload-success=
"cropSuccess"
:key=
"imagecropperKey"
v-show=
"imagecropperShow"
/>
v-show=
"imagecropperShow"
/>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
...
@@ -21,13 +20,15 @@
...
@@ -21,13 +20,15 @@
data
()
{
data
()
{
return
{
return
{
imagecropperShow
:
false
,
imagecropperShow
:
false
,
imagecropperKey
:
0
imagecropperKey
:
0
,
image
:
'https://wpimg.wallstcn.com/577965b9-bb9e-4e02-9f0c-095b41417191'
}
}
},
},
methods
:
{
methods
:
{
cropSuccess
()
{
cropSuccess
(
resData
)
{
this
.
imagecropperShow
=
false
;
this
.
imagecropperShow
=
false
;
this
.
imagecropperKey
=
this
.
imagecropperKey
+
1
;
this
.
imagecropperKey
=
this
.
imagecropperKey
+
1
;
this
.
image
=
resData
.
files
.
avatar
;
}
}
}
}
};
};
...
...
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