selectedImageInEditor.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <div class="img-wrapper">
  3. <img :src="imgSrc || defaultImgSrc" alt="">
  4. <div v-if="imgSrc" class="cancel-btn-background" @click="$emit('cancel')">
  5. <i class="iconfont icon-pop-ups_shut-down"></i>
  6. </div>
  7. </div>
  8. </template>
  9. <script>
  10. export default {
  11. props: {
  12. imgSrc: {
  13. type: String,
  14. default: '',
  15. },
  16. defaultImgSrc: {
  17. type: String,
  18. require: true,
  19. }
  20. }
  21. }
  22. </script>
  23. <style lang="less" scoped>
  24. .img-wrapper {
  25. flex: 0 0 auto;
  26. position: relative;
  27. width: 136px;
  28. height: 136px;
  29. margin-right: 16px;
  30. background: #1A1B1D;
  31. border-radius: 4px;
  32. border: 1px solid #404040;
  33. overflow: hidden;
  34. > img {
  35. width: 100%;
  36. height: 100%;
  37. object-fit: contain;
  38. }
  39. > .cancel-btn-background {
  40. width: 52px;
  41. height: 52px;
  42. position: absolute;
  43. top: -28px;
  44. right: -28px;
  45. background: rgba(0, 0, 0, 0.5);
  46. border-radius: 50%;
  47. cursor: pointer;
  48. &:hover {
  49. color: #FA5555;
  50. }
  51. > i {
  52. font-size: 12px;
  53. transform: scale(0.8);
  54. position: absolute;
  55. left: 9px;
  56. bottom: 9px;
  57. }
  58. }
  59. }
  60. </style>