shareImg.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <script>
  2. export default {
  3. name: 'shareImg',
  4. props: {
  5. cvsTempImg: {
  6. type: String,
  7. default: ''
  8. }
  9. },
  10. data() {
  11. return {
  12. show: false
  13. }
  14. },
  15. methods: {
  16. save() {
  17. uni.saveImageToPhotosAlbum({
  18. filePath: this.cvsTempImg,
  19. success: () => {
  20. this.show = false
  21. this.$common.toast('保存成功')
  22. }
  23. })
  24. }
  25. }
  26. }
  27. </script>
  28. <template>
  29. <u-popup :show="show" mode="center" @close="show = false" bg-color="transparent">
  30. <view class="container"><image :src="cvsTempImg" class="cvsTempImg"></image></view>
  31. <view class="mt-20 flex flex-center">
  32. <view class="cancel-icon" @click="show = false">
  33. <u-icon name="close" size="40rpx" color="#fff"></u-icon>
  34. </view>
  35. <view class="download-icon ml-40" @click="save">
  36. <u-icon name="download" size="40rpx" color="#fff"></u-icon>
  37. </view>
  38. </view>
  39. </u-popup>
  40. </template>
  41. <style lang="scss" scoped>
  42. .cancel-icon,
  43. .download-icon {
  44. width: 70rpx;
  45. height: 70rpx;
  46. border-radius: 50%;
  47. display: flex;
  48. justify-content: center;
  49. align-items: center;
  50. background-color: rgba(0, 0, 0, 0.3);
  51. }
  52. .cvsTempImg {
  53. width: calc(375rpx * 1.2);
  54. height: calc(667rpx * 1.2);
  55. }
  56. </style>