Files
nl-admin-view/packages/effects/common-ui/src/ui/authentication/qrcode-login.vue
xingyu a4736a49f8 feat: migrate to Tailwind CSS v4 (#7614)
* chore: update deps

* feat: use jsonc/x language

* chore: update eslint 10.0

* fix: no-useless-assignment

* feat: add CLAUDE.md

* chore: ignore

* feat: claude

* fix: lint

* chore: suppot eslint v10

* fix: lint

* fix: lint

* fix: type check

* fix: unit test

* fix: Suggested fix

* fix: unit test

* chore: update stylelint v17

* chore: update all major deps

* fix:  echarts console warn

* chore: update vitest v4

* feat: add skills ignores

* chore: update deps

* chore: update deps

* fix: cspell

* chore: update deps

* chore: update tailwindcss v4

* chore: remove postcss config

* fix: no use catalog

* chore: tailwind v4 config

* fix: tailwindcss v4 sort

* feat: use eslint-plugin-better-tailwindcss

* fix: Interference between enforce-consistent-line-wrapping, jsx-curly-brace-presence and Prettier

* fix: Interference between enforce-consistent-line-wrapping, jsx-curly-brace-presence and Prettier

* fix(lint): resolve prettier and better-tailwindcss formatting conflicts

* fix(tailwind): update theme references and lint sources

* style(format): normalize apps docs and playground vue files

* style(format): normalize core ui-kit components

* style(format): normalize effects ui and layout components
2026-03-10 05:08:45 +08:00

106 lines
2.0 KiB
Vue

<script setup lang="ts">
import { ref } from 'vue';
import { useRouter } from 'vue-router';
import { $t } from '@vben/locales';
import { VbenButton } from '@vben-core/shadcn-ui';
import { useQRCode } from '@vueuse/integrations/useQRCode';
import Title from './auth-title.vue';
interface Props {
/**
* @zh_CN 是否处于加载处理状态
*/
loading?: boolean;
/**
* @zh_CN 登录路径
*/
loginPath?: string;
/**
* @zh_CN 标题
*/
title?: string;
/**
* @zh_CN 描述
*/
subTitle?: string;
/**
* @zh_CN 按钮文本
*/
submitButtonText?: string;
/**
* @zh_CN 描述
*/
description?: string;
/**
* @zh_CN 是否显示返回按钮
*/
showBack?: boolean;
}
defineOptions({
name: 'AuthenticationQrCodeLogin',
});
const props = withDefaults(defineProps<Props>(), {
description: '',
loading: false,
showBack: true,
loginPath: '/auth/login',
submitButtonText: '',
subTitle: '',
title: '',
});
const router = useRouter();
const text = ref('https://vben.vvbin.cn');
const qrcode = useQRCode(text, {
errorCorrectionLevel: 'H',
margin: 4,
});
function goToLogin() {
router.push(props.loginPath);
}
</script>
<template>
<div>
<Title>
<slot name="title">
{{ title || $t('authentication.welcomeBack') }} 📱
</slot>
<template #desc>
<span class="text-muted-foreground">
<slot name="subTitle">
{{ subTitle || $t('authentication.qrcodeSubtitle') }}
</slot>
</span>
</template>
</Title>
<div class="mt-6 flex-col-center">
<img :src="qrcode" alt="qrcode" class="w-1/2" />
<p class="mt-4 text-sm text-muted-foreground">
<slot name="description">
{{ description || $t('authentication.qrcodePrompt') }}
</slot>
</p>
</div>
<VbenButton
v-if="showBack"
class="mt-4 w-full"
variant="outline"
@click="goToLogin()"
>
{{ $t('common.back') }}
</VbenButton>
</div>
</template>