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,6 +38,9 @@ export default { | ||
| 38 | } | 38 | } |
| 39 | }, | 39 | }, |
| 40 | methods: { | 40 | methods: { |
| 41 | + showGallery () { | ||
| 42 | + this.innerVisible = true | ||
| 43 | + }, | ||
| 41 | handleClose () { | 44 | handleClose () { |
| 42 | this.innerVisible = false | 45 | this.innerVisible = false |
| 43 | }, | 46 | }, |
| @@ -63,24 +66,25 @@ export default { | @@ -63,24 +66,25 @@ export default { | ||
| 63 | renderDefaultActivator () { | 66 | renderDefaultActivator () { |
| 64 | const activatorWithoutImg = ( | 67 | const activatorWithoutImg = ( |
| 65 | <div | 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 | <a-icon type="plus" /> | 72 | <a-icon type="plus" /> |
| 70 | </div> | 73 | </div> |
| 71 | ) | 74 | ) |
| 72 | 75 | ||
| 73 | const activatorWithImg = ( | 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 | <div class="flex-space-between" style="margin-top: 8px;"> | 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 | e.stopPropagation() | 85 | e.stopPropagation() |
| 83 | - }}>裁剪图片</a-button> | 86 | + this.handleSelectImage({ previewURL: '' }) |
| 87 | + }}>移除</a-button> | ||
| 84 | </div> | 88 | </div> |
| 85 | </div> | 89 | </div> |
| 86 | ) | 90 | ) |
front-end/h5/src/components/core/support/image-gallery/gallery.scss
| @@ -3,7 +3,12 @@ | @@ -3,7 +3,12 @@ | ||
| 3 | text-align: center; | 3 | text-align: center; |
| 4 | 4 | ||
| 5 | img { | 5 | img { |
| 6 | - width: 100%; | 6 | + width: 50%; |
| 7 | border: 1px dashed #ccc; | 7 | border: 1px dashed #ccc; |
| 8 | } | 8 | } |
| 9 | +} | ||
| 10 | + | ||
| 11 | +.empty-bg-activator { | ||
| 12 | + height: 178px; | ||
| 13 | + line-height: 178px; | ||
| 9 | } | 14 | } |
| 10 | \ No newline at end of file | 15 | \ No newline at end of file |