云
6 小时以前 5d321660a2f1a4b8756f816283e96481a8c934e4
src/packages/effects/common-ui/src/components/captcha/verification/index.vue
@@ -5,7 +5,15 @@
 */
import type { VerificationProps } from './typing';
import { defineAsyncComponent, markRaw, ref, toRefs, watchEffect } from 'vue';
import {
  computed,
  defineAsyncComponent,
  markRaw,
  nextTick,
  ref,
  toRefs,
  watchEffect,
} from 'vue';
import { IconifyIcon } from '../../../../../../icons/src';
@@ -58,8 +66,20 @@
};
const show = () => {
  if (mode.value === 'pop') showBox.value = true;
  if (mode.value === 'pop') {
    showBox.value = true;
    // 每次打开按当前视口重新计算尺寸,适配移动端
    nextTick(() => instance.value?.init?.());
  }
};
/** 弹窗最大宽度,避免窄屏溢出 */
const boxMaxWidth = computed(() => {
  const width = Number.parseInt(String(props.imgSize.width));
  const limit =
    typeof window === 'undefined' ? 420 : window.innerWidth - 24;
  return `${Math.min(width + 20, limit)}px`;
});
const onError = (proxy: any) => {
  emit('onError', proxy);
@@ -109,7 +129,7 @@
  <div v-show="showBox">
    <div
      :class="mode === 'pop' ? 'verifybox' : ''"
      :style="{ 'max-width': `${parseInt(imgSize.width) + 20}px` }"
      :style="{ 'max-width': boxMaxWidth }"
    >
      <div v-if="mode === 'pop'" class="verifybox-top">
        {{ $t('ui.captcha.title') }}