picture-viewer.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <view class="pic-comp-container">
  3. <image class="picComp" :src="src" mode="aspectFill" @click="click"></image>
  4. <view class="delete-btn" @click="handleDelete">×</view>
  5. </view>
  6. </template>
  7. <script>
  8. export default {
  9. props: {
  10. src: {
  11. type: String,
  12. default: ''
  13. }
  14. },
  15. methods: {
  16. click() {
  17. this.$emit('needPreviewPic', this.src)
  18. },
  19. handleDelete() {
  20. this.$emit('delete')
  21. }
  22. }
  23. }
  24. </script>
  25. <style scoped>
  26. .pic-comp-container {
  27. width: 200rpx;
  28. height: 200rpx;
  29. box-sizing: border-box;
  30. /* overflow: hidden; */
  31. position: relative;
  32. }
  33. .picComp {
  34. width: 200rpx !important;
  35. height: 200rpx !important;
  36. object-fit: cover;
  37. border-radius: 30rpx;
  38. }
  39. .delete-btn {
  40. width: 40rpx;
  41. height: 40rpx;
  42. line-height: 40rpx;
  43. text-align: center;
  44. background: #ff4757;
  45. color: #fff;
  46. border-radius: 50%;
  47. position: absolute;
  48. top: -10rpx;
  49. right: -20rpx;
  50. }
  51. </style>