@kqstone/account-ui-vue

Vue 3 login, register, 2FA, WeChat QR login, profile and avatar components for account-kit
Install
npm install @kqstone/account-ui-vue
Latest Version:0.4.1
Vue:3
License:MIT
Last Updated:Oct 24, 2026
Links: GitHub  ·  npm
Maintainer: kqstone

@kqstone/account-ui-vue

account-kit 的 Vue 3 界面组件。

  • 表单:LoginForm、RegisterForm、ResetPasswordForm
  • 两步验证:TwoFactorSettings、TwoFactorLoginDialog
  • 微信:WechatQrLogin、WechatBindSettings(模块默认关闭;start 503 提示未配置)
  • 资料:ProfileFields、AvatarUploader、UserAvatar
  • 其它:TierBadge、createAccountClient

从 npmjs 直接安装:

npm install @kqstone/account-ui-vue
# 可选:用于设置页二维码。也可传入 renderQr。
npm install qrcode
<script setup lang="ts">
import { ref } from "vue"
import {
  createAccountClient,
  LoginForm,
  TwoFactorLoginDialog,
  TwoFactorSettings,
  WechatQrLogin,
  WechatBindSettings,
  getMfaChallenge,
  getTrustedDeviceToken,
  trustedDeviceScope,
} from "@kqstone/account-ui-vue"

const client = createAccountClient("/api/auth")
const token = ref("")
const mfa = ref(null)

function onSuccess(accessToken) {
  token.value = accessToken
  localStorage.setItem("token", accessToken)
}
</script>

<template>
  <LoginForm
    :client="client"
    device-name="web"
    :trusted-device-token="(name) => getTrustedDeviceToken(trustedDeviceScope('', name))"
    @success="onSuccess"
    @mfa="mfa = $event"
  />
  <TwoFactorLoginDialog
    v-if="mfa"
    :client="client"
    :challenge="mfa"
    device-name="web"
    :scope="trustedDeviceScope('', mfa.username)"
    @success="(data) => { onSuccess(data.access_token); mfa = null }"
    @cancel="mfa = null"
    @expired="mfa = null"
  />
  <WechatQrLogin :client="client" device-name="web" @success="onSuccess" />
  <TwoFactorSettings v-if="token" :client="client" :token="token" />
  <WechatBindSettings v-if="token" :client="client" :token="token" />
</template>

文案通过 language(zh-CN / en,旧值 zh 仍兼容)和组件 labels 覆盖。也可用插件 accountKitI18n({ locale, i18n, messages }) 或 provideAccountI18n(followVueI18n(i18n), messages);对接 vue-i18n 时把实例传给插件的 i18n,或用 duck-typed followVueI18n(i18n)(不 import vue-i18n)。createAccountClient({ getLocale: followVueI18n(i18n) }) 每请求带 X-Locale。二维码:安装 peer qrcode,或传入 renderQr(otpauthUri) => dataUrl。

样式在组件首次渲染时以 <style id="account-kit-ui"> 注入,class 前缀为 ak-。需要 vue ^3.2。

导出

LoginForm RegisterForm ResetPasswordForm TwoFactorSettings TwoFactorLoginDialog WechatQrLogin WechatBindSettings AvatarUploader UserAvatar ProfileFields TierBadge createAccountClient accountKitI18n provideAccountI18n useAccountI18n followVueI18n formatError resolveLocale getMfaChallenge getTrustedDeviceToken saveTrustedDeviceToken clearTrustedDeviceToken clearTrustedDeviceTokensForUser trustedDeviceScope

MIT License

Related Packages

@loltech/vue3-2fa-code-input

Vue 3 input component for 2FA codes. Is alpha-numerically agnostic, supports cop...

7,587 4
lukk-nuxt

Nuxt module for lukk (first-party Laravel JWT auth) + useLukkFetch, an auth-awar...

2,402 0
@authup/client-auth-console

Authup's hosted login, consent, registration, password recovery and device pages...

1,630 41
@d0whc3r/vue-auth-plugin

A simple authentication and authorization library for Vue.js using typescript

4,149 58
@deppon/deppon-auth

Login and permission management package

18,162

Version History

Version Released Vue License
0.4.1 ^3.2.0 MIT
0.4.0 ^3.2.0 MIT
0.3.0 ^3.2.0 MIT
Pre-releases (1)
Version Released License
0.0.0-stage