fix: captcha ref not defined

This commit is contained in:
Tony Yang
2025-04-17 02:04:35 +08:00
parent ceda1e8c1c
commit 8a952e3251
5 changed files with 14 additions and 7 deletions
+4 -1
View File
@@ -1,5 +1,5 @@
<script setup>
import { ref, computed, defineProps } from 'vue';
import { ref, computed, defineProps, useTemplateRef } from 'vue';
import { useRouter } from 'vue-router';
import { uploadAvatar } from '../../lib/api';
import CAPTCHA from '../CAPTCHA.vue';
@@ -17,6 +17,8 @@ const router = useRouter();
const avatarFile = ref(null);
const avatarError = ref('');
const captcha = useTemplateRef('captcha');
const captchaResponse = ref(null);
const onFileChange = (event) => {
@@ -101,6 +103,7 @@ const avatarUrl = computed(() => {
</div>
</div>
<CAPTCHA
ref="captcha"
:hcaptchaSitekey="$hcaptchaSitekey"
:recaptchaSitekey="$recaptchaSitekey"
:turnstileSitekey="$turnstileSitekey"