Commit e1baa2593d52a5623db5b9995e077ba6dbdb84ff
1 parent
3c40c452
feat(image-gallery) support delete background image
Showing
3 changed files
with
24 additions
and
11 deletions
front-end/h5/src/components/core/styles/index.scss
front-end/h5/src/components/core/support/image-gallery/gallery.js
| ... | ... | @@ -38,6 +38,9 @@ export default { |
| 38 | 38 | } |
| 39 | 39 | }, |
| 40 | 40 | methods: { |
| 41 | + showGallery () { | |
| 42 | + this.innerVisible = true | |
| 43 | + }, | |
| 41 | 44 | handleClose () { |
| 42 | 45 | this.innerVisible = false |
| 43 | 46 | }, |
| ... | ... | @@ -63,24 +66,25 @@ export default { |
| 63 | 66 | renderDefaultActivator () { |
| 64 | 67 | const activatorWithoutImg = ( |
| 65 | 68 | <div |
| 66 | - class="default-activator cursor-pointer " | |
| 67 | - onClick={() => { this.innerVisible = true }} | |
| 69 | + class="default-activator cursor-pointer empty-bg-activator" | |
| 70 | + onClick={this.showGallery} | |
| 68 | 71 | > |
| 69 | 72 | <a-icon type="plus" /> |
| 70 | 73 | </div> |
| 71 | 74 | ) |
| 72 | 75 | |
| 73 | 76 | const activatorWithImg = ( |
| 74 | - <div | |
| 75 | - class="default-activator cursor-pointer " | |
| 76 | - onClick={() => { this.innerVisible = true }} | |
| 77 | - > | |
| 78 | - <img src={this.value} /> | |
| 77 | + <div onClick={this.showGallery}> | |
| 78 | + <div class="default-activator cursor-pointer "><img src={this.value} width="50%" style={{ margin: 'auto' }} /></div> | |
| 79 | 79 | <div class="flex-space-between" style="margin-top: 8px;"> |
| 80 | - <a-button>更换图片</a-button> | |
| 81 | - <a-button onClick={e => { | |
| 80 | + <a-button size="small">更换</a-button> | |
| 81 | + <a-button size="small" onClick={e => { | |
| 82 | + e.stopPropagation() | |
| 83 | + }}>裁剪</a-button> | |
| 84 | + <a-button size="small" onClick={(e) => { | |
| 82 | 85 | e.stopPropagation() |
| 83 | - }}>裁剪图片</a-button> | |
| 86 | + this.handleSelectImage({ previewURL: '' }) | |
| 87 | + }}>移除</a-button> | |
| 84 | 88 | </div> |
| 85 | 89 | </div> |
| 86 | 90 | ) | ... | ... |
front-end/h5/src/components/core/support/image-gallery/gallery.scss