custom-popup.vue 2.1 KB
<template>
  <view class="mask-wrap" v-if="isShowPopup">
    <view class="center-content">
      <slot>
        <view class="top-wrap">
          <template v-if="isShowClose">
            <image @click="closePopup" class="close-img" src="/static/images/close-icon.png"></image>
          </template>
          <image class="poster-img" :src="posterImg" show-menu-by-longpress></image>
          <view class="btn-wrap">
            <view class="save-btn">长按图片保存</view>
          </view>
        </view>
      </slot>
    </view>
  </view>
</template>

<script setup>
  import { onMounted, ref } from 'vue'
  const emits = defineEmits(['closePopup'])
  const props = defineProps({
    isShowPopup: {
      type: Boolean,
      default: false
    },
    isShowClose: {
      type: Boolean,
      default: false
    },
    posterImg: {
      type: String,
      default: '/static/images/vip-icon.png'
    }
  })

  function closePopup() {
    emits('closePopup')
  }
</script>

<style lang="scss">
  .mask-wrap {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    background-color: #000000;
  }

  .center-content {
    @include flexColumn();
    position: relative;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 686rpx;
    padding: 48rpx 32rpx 24rpx 32rpx;
    box-sizing: border-box;
    background-color: #fff;
    border-radius: 32rpx;
    height: 720rpx;
    border-radius: 0 0 12rpx 12rpx;
    background: #151419ff;

    .top-wrap {
      .poster-img {
        border-radius: 16rpx;
        height: 630rpx;
        width: 600rpx;
      }

      .btn-wrap {
        .save-btn {
          width: 600rpx;
          height: 72rpx;
          text-align: center;
          line-height: 72rpx;
          margin-top: 20rpx;
          color: #000;
          border-radius: 12rpx;
          background: #fcd19aff;
        }
      }

    }

    .close-img {
      position: absolute;
      z-index: 99;
      right: 60rpx;
      top: 70rpx;
      width: 40rpx;
      height: 40rpx;
    }

    .function-btns {
      margin-top: 22rpx;
      @include flexCj();
    }
  }
</style>