Skip to content

Commit 10f2552

Browse files
committed
upload
1 parent 8fa850a commit 10f2552

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/components/Uploader/index.vue

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<template>
22
<div class="component-uploader">
3+
<slot></slot>
34
<input type="file" name="file" @change="onChange($event)">
45
</div>
56
</template>
7+
68
<script>
79
export default {
810
props: {
@@ -30,4 +32,20 @@ export default {
3032
}
3133
}
3234
</script>
33-
<style></style>
35+
36+
<style>
37+
.component-uploader {
38+
position: relative;
39+
}
40+
41+
.component-uploader input {
42+
position: absolute;
43+
top: 0;
44+
left: 0;
45+
right: 0;
46+
bottom: 0;
47+
opacity: 0;
48+
background: none;
49+
cursor: pointer;
50+
}
51+
</style>

src/views/Account/Profile.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
<div class="view-profile container">
33
<div class="col-sm-4 col-sm-offset-4">
44
<img :src="src" alt="" class="img-responsive img-cycle">
5-
<Uploader :url="url" @success="onUploadSuccess" @error="onUploadError"></Uploader>
5+
<Uploader :url="url" @success="onUploadSuccess" @error="onUploadError">
6+
<button class="btn btn-default">上传</button>
7+
</Uploader>
68
</div>
79
</div>
810
</template>

0 commit comments

Comments
 (0)