forgot-form.vue
1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<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>