add remove

This commit is contained in:
liangping 2021-08-14 10:32:45 +08:00
parent 3298a10397
commit 977d59553a

View File

@ -26,19 +26,46 @@
<b-card <b-card
no-body no-body
class="card-browser-states text-truncate" class="card-browser-states"
> >
<b-card-header> <b-card-header>
<div> <div>
<b-card-title> <span class="text-uppercase">{{ acc.chain }}</span></b-card-title> <b-card-title> <span class="text-uppercase">{{ acc.chain }}</span></b-card-title>
</div> </div>
<feather-icon <b-dropdown
icon="MoreVerticalIcon" class="ml-1"
size="18" variant="link"
class="cursor-pointer" no-caret
/> toggle-class="p-0"
right
>
<template #button-content>
<feather-icon
icon="MoreVerticalIcon"
size="18"
class="cursor-pointer"
/>
</template>
<b-dropdown-item
v-if="balances[acc.addr]"
@click="removeAddress(acc.chain)"
>
Send
</b-dropdown-item>
<b-dropdown-item
v-if="balances[acc.addr]"
@click="removeAddress(acc.chain)"
>
Detail
</b-dropdown-item>
<b-dropdown-item @click="removeAddress(acc.addr)">
Remove
</b-dropdown-item>
</b-dropdown>
</b-card-header> </b-card-header>
<b-card-body> <b-card-body class="text-truncate">
<b-row> <b-row>
<b-col> <b-col>
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
@ -113,7 +140,7 @@
<script> <script>
import chainAPI from '@/libs/fetch' import chainAPI from '@/libs/fetch'
import { import {
BCard, BCardHeader, BCardTitle, BCardBody, VBModal, BRow, BCol, BTabs, BTab, BAvatar, BCard, BCardHeader, BCardTitle, BCardBody, VBModal, BRow, BCol, BTabs, BTab, BAvatar, BDropdown, BDropdownItem,
} from 'bootstrap-vue' } from 'bootstrap-vue'
import Ripple from 'vue-ripple-directive' import Ripple from 'vue-ripple-directive'
import FeatherIcon from '@/@core/components/feather-icon/FeatherIcon.vue' import FeatherIcon from '@/@core/components/feather-icon/FeatherIcon.vue'
@ -134,6 +161,8 @@ export default {
BCardHeader, BCardHeader,
BCardBody, BCardBody,
BCardTitle, BCardTitle,
BDropdown,
BDropdownItem,
FormWizardNumber, FormWizardNumber,
FeatherIcon, FeatherIcon,
}, },
@ -208,6 +237,14 @@ export default {
} }
return 0 return 0
}, },
removeAddress(v) {
Object.values(this.accounts).forEach(item => {
const newAddrs = item.address.filter(a => a.addr !== v)
console.log(item, newAddrs, v)
this.$set(item, 'address', newAddrs)
})
localStorage.setItem('accounts', JSON.stringify(this.accounts))
},
}, },
} }
</script> </script>