From 398393feb2512890f01e935422d53cda7fa8babd Mon Sep 17 00:00:00 2001 From: cylim Date: Sat, 20 Jan 2024 12:22:08 +0800 Subject: [PATCH] add event listener on switch wallet --- lib/components/ConnectWallet/index.vue | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/components/ConnectWallet/index.vue b/lib/components/ConnectWallet/index.vue index 5775354..53f7d8e 100644 --- a/lib/components/ConnectWallet/index.vue +++ b/lib/components/ConnectWallet/index.vue @@ -10,6 +10,7 @@ import { } from '../../../lib/wallet/Wallet'; import { readWallet } from '../../../lib/wallet/Wallet'; import { Icon } from '@iconify/vue'; +import { onMounted, onUnmounted } from 'vue'; const props = defineProps({ chainId: String, @@ -43,6 +44,13 @@ const list = [ } ]; +onMounted(() => { + window.addEventListener("keplr_keystorechange", connect) +}) +onUnmounted(() => { + window.removeEventListener('keplr_keystorechange', connect) +}) + async function initData() { } const walletList = computed(() => {