base on @raydius/auth
, like @raydius/react
To integrate the Raydius Vue SDK, your project must be on:
- a minimum Vue version of 3.x
- a minimum TypeScript version of 5
(Installation)
// npm
npm i @raydius/vue
// yarn
yarn add @raydius/vue
(Set Up Your App with Raydius)
// main.js
import { RaydiusVuePlugin } from "@raydius/vue";
import App from "./App.vue";
import { createApp } from "vue";
// import style
import "@raydius/vue/style.css";
const config = {
appId: "xxx",
}
createApp(App)
.use(RaydiusVuePlugin, {
config,
})
.mount("#app");
(Using the useRaydius Hook)
// App.vue or other vue component
<script setup>
import { useRaydius } from '@raydius/vue'
const { login, logout, userAccount } = useRaydius()
</script>
<template>
<button @click="login">login</button>
<button @click="logout">logout</button>
<div>
UserAccount :
<pre>{{ userAccount }}</pre>
</div>
</template>
attr | required | description | default |
---|---|---|---|
appId | true | get from | - |
theme | false | theme for Raydius component, the value can be 'light' or 'dark' | dark |
defaultChain | false | defaultChain | |
supportedChains | false | Array of chain, chain must be imported from '@wagmi/vue/chains' | [ mainnet, goerli, sepolia, optimism, optimismSepolia, polygon, polygonMumbai, arbitrum, arbitrumSepolia, base, baseSepolia, bsc, bscTestnet, scroll, scrollSepolia ] |
allowMethods | false | Array of social login method | ["farcaster", "twitter", "google"] |
allowWallets | false | Array of wallet login method | ["metaMask", "walletConnect", "tomo"] |