Skip to content

Commit dd73827

Browse files
committed
fix avatar component bug
1 parent 4fc649e commit dd73827

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/components/ImageCropper/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@
328328
// 关闭控件
329329
off() {
330330
this.show = false;
331+
this.$emit('close');
331332
},
332333
// 设置步骤
333334
setStep(step) {

src/views/components/avatarUpload.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
<el-button type="primary" icon="upload" style="position: absolute;bottom: 15px;margin-left: 40px;" @click="imagecropperShow=true">修改头像
1010
</el-button>
1111

12-
<ImageCropper :width="300" :height="300" url="https://httpbin.org/post" @crop-upload-success="cropSuccess" :key="imagecropperKey" v-show="imagecropperShow" />
12+
<ImageCropper :width="300" :height="300" url="https://httpbin.org/post" @close='close' @crop-upload-success="cropSuccess"
13+
:key="imagecropperKey" v-show="imagecropperShow" />
1314
</div>
1415
</template>
16+
1517
<script>
1618
import ImageCropper from 'components/ImageCropper';
1719
import PanThumb from 'components/PanThumb';
@@ -29,6 +31,9 @@
2931
this.imagecropperShow = false;
3032
this.imagecropperKey = this.imagecropperKey + 1;
3133
this.image = resData.files.avatar;
34+
},
35+
close() {
36+
this.imagecropperShow = false;
3237
}
3338
}
3439
};

0 commit comments

Comments
 (0)