add symbol on button

This commit is contained in:
liangping 2021-11-23 14:30:21 +08:00
parent a198e3c281
commit 00bb9d1003

View File

@ -92,7 +92,7 @@
block block
:variant="type === 0 ? 'success': 'danger'" :variant="type === 0 ? 'success': 'danger'"
> >
{{ type === 0 ? 'Buy' : 'Sell' }} {{ type === 0 ? `Buy ${ base }` : `Sell ${ base }` }}
</BButton> </BButton>
</b-form-group> </b-form-group>
<b-alert <b-alert
@ -116,6 +116,7 @@ import {
BFormInput, BButton, BAlert, BFormGroup, BInputGroup, BInputGroupAppend, BFormRadio, BFormInput, BButton, BAlert, BFormGroup, BInputGroup, BInputGroupAppend, BFormRadio,
} from 'bootstrap-vue' } from 'bootstrap-vue'
import FeatherIcon from '@/@core/components/feather-icon/FeatherIcon.vue' import FeatherIcon from '@/@core/components/feather-icon/FeatherIcon.vue'
import { abbrAddress, getLocalAccounts } from '@/libs/data'
export default { export default {
components: { components: {
@ -144,6 +145,7 @@ export default {
}, },
data() { data() {
return { return {
selectedAddress: this.computeAccounts()[0],
available: 0, available: 0,
amount: 0, amount: 0,
total: 0, total: 0,
@ -158,6 +160,18 @@ export default {
const p2 = this.$store.state.chains.quotes[this.target] const p2 = this.$store.state.chains.quotes[this.target]
return p1 && p2 ? (p1.usd / p2.usd).toFixed(4) : '-' return p1 && p2 ? (p1.usd / p2.usd).toFixed(4) : '-'
}, },
computeAccounts() {
const accounts = getLocalAccounts()
const values = accounts ? Object.values(accounts) : []
let array = []
for (let i = 0; i < values.length; i += 1) {
const addrs = values[i].address.filter(x => x.chain === this.$route.params.chain)
if (addrs && addrs.length > 0) {
array = array.concat(addrs.map(x => ({ value: x.addr, label: values[i].name.concat(' - ', abbrAddress(x.addr)) })))
}
}
return array
},
}, },
methods: { methods: {
changeAmount() { changeAmount() {