BackPress.uvue 1.95 KB
<!-- 退出弹框 -->
<template>
  <MessageBox  ref="finishRef" :content="finishContene" :isFooter="false">
    <view class="footer">
      <view class="footer-btn confirm flex" @click="$emit('openStep')">
        <template v-if="finishDoneText">
          {{ finishDoneText }}
        </template>
        <template v-else>
          完成接待
          <text class="btn-text">
            (推荐)
          </text>
        </template>
      </view>
      <view class="footer-btn cancel flex" @click="$emit('backHome')">
        仍要退出
        <text class="btn-text">
          (不推荐)
        </text>
      </view>
    </view>
  </MessageBox>
</template>

<script setup lang="uts">
  import MessageBox from './MessageBox.uvue'
  import { callComponentMethod } from '@/utils/common.uts'

  const props = defineProps({
      finishDoneText: String,
      finishContene: {
        type: String,
        default: '当前操作视为强制退出接待,若需正常流程完成接待请点击「完成接待」'
      }
    })
  const finishRef = ref(null)
  function open(): void {
     callComponentMethod(finishRef, 'open')
  }
  function hide(): void {
    callComponentMethod(finishRef, 'close')
  }
  const emit = defineEmits(['openStep', 'backHome'])
  defineExpose({ open, hide })
</script>

<style lang="scss">
  .footer {
    border-top: 2rpx solid #eff0f2;
    font-weight: 600;
    font-size: 32rpx;
    margin-top: 48rpx;

    .footer-btn {
      justify-content: center;
      margin: 16rpx auto 0;
      flex-direction: row;
      align-items: center;
    }

    .confirm {
      width: 608rpx;
      height: 80rpx;
      background: #2c66f7;
      border-radius: 40rpx;
      color: #fff;
    }

    .cancel {
      width: 608rpx;
      height: 80rpx;
      background: #ffffff00;
      border-radius: 40rpx;
      color: #2c66f7;
    }

    .btn-text {  // ✅ UVUE 只支持类名选择器,不能使用元素选择器 text
      font-size: 24rpx;
    }
  }
</style>