forgot-form.vue 1.48 KB
<template>
  <a-form v-model="formValue" class="login-form" size="small" auto-label-width>
    <a-form-item show-colon label="找回方式" style="margin-bottom: 10px">
      <a-radio-group v-model="apply" :options="applyType" />
    </a-form-item>
    <a-form-item v-if="apply === 1" show-colon label="手机号">
      <a-input v-model="formValue.phone" max-length="14" placeholder="请输入" />
    </a-form-item>
    <a-form-item v-else show-colon label="邮箱">
      <a-input v-model="email" placeholder="请输入" />
    </a-form-item>
    <a-form-item show-colon label="验证码">
      <a-row :gutter="8">
        <a-col :span="18">
          <a-input v-model="formValue.code" max-length="6" placeholder="请输入" />
        </a-col>
        <a-col :span="6">
          <a-button html-type="submit" type="primary">获取</a-button>
        </a-col>
      </a-row>
    </a-form-item>
    <div class="form-actions">
      <a-link @click="type = 'login'">返回</a-link>
      <a-button html-type="submit" type="primary">提交</a-button>
    </div>
  </a-form>
</template>

<script lang="ts" setup>
  import { inject, ref } from 'vue';

  const type = inject('type');

  const apply = ref(1);
  const applyType = ref([
    { value: 1, label: '手机号' },
    { value: 2, label: '邮箱' },
  ]);

  const email = ref('');

  const formValue = ref({
    phone: '',
    code: '',
  });
</script>

<style scoped>
  .form-actions {
    display: flex;
    justify-content: space-between;
  }
</style>