perf(client): use shallowRef for html element ref

This commit is contained in:
syuilo 2023-01-03 10:12:37 +09:00
parent a0af80f8c5
commit 2184240ef1
59 changed files with 114 additions and 115 deletions

View file

@ -6,7 +6,7 @@
</template>
<script lang="ts" setup>
import { ref, computed, onMounted, onBeforeUnmount, watch } from 'vue';
import { ref, shallowRef, computed, onMounted, onBeforeUnmount, watch } from 'vue';
import { defaultStore } from '@/store';
import { i18n } from '@/i18n';
@ -42,7 +42,7 @@ const emit = defineEmits<{
const available = ref(false);
const captchaEl = ref<HTMLDivElement | undefined>();
const captchaEl = shallowRef<HTMLDivElement | undefined>();
const variable = computed(() => {
switch (props.provider) {
@ -62,7 +62,7 @@ const src = computed(() => {
}
});
const scriptId = computed(() => `script-${props.provider}`)
const scriptId = computed(() => `script-${props.provider}`);
const captcha = computed<Captcha>(() => window[variable.value] || {} as unknown as Captcha);