fave3722 3 years ago
parent
commit
5a3f3cbc71
  1. 27
      src/components/table/desktop/tokensDetails.vue

27
src/components/table/desktop/tokensDetails.vue

@ -7,7 +7,9 @@
> >
<p class="underline text-blue-65B5FF">{{ currentData?.address }}</p> <p class="underline text-blue-65B5FF">{{ currentData?.address }}</p>
<div class="flex flex-row"> <div class="flex flex-row">
<Icons :url="'copyAddress'" :size="32" /> <div @click="handleCopy">
<Icons :url="'copyAddress'" :size="32" />
</div>
<div @click="open"> <div @click="open">
<Icons :url="'qrCode'" :size="32" class="ml-[16px]" /> <Icons :url="'qrCode'" :size="32" class="ml-[16px]" />
</div> </div>
@ -25,14 +27,16 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref, watchEffect } from 'vue' import { ref, watchEffect } from 'vue'
import { ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import Qrcode from 'qrcode' import Qrcode from 'qrcode'
import tokensDetailsRow from '../dBase/tokensDetailsRow.vue' import tokensDetailsRow from '../dBase/tokensDetailsRow.vue'
import { tokensDetailsCollocate } from '../constant' import { tokensDetailsCollocate } from '../constant'
import Icons from '@src/components/icons/index.vue' import Icons from '@src/components/icons/index.vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { getAddressInfo } from '@src/api/AddressController' import { getAddressInfo } from '@src/api/AddressController'
import useClipboard from 'vue-clipboard3'
const invariable = { const invariable = {
...tokensDetailsCollocate, ...tokensDetailsCollocate,
} }
@ -65,7 +69,7 @@ watchEffect(() => {
}) })
let open = async () => { let open = async () => {
const res = await Qrcode.toDataURL('https://baidu.com' as string) const res = await Qrcode.toDataURL(currentData.value?.address as string)
// //
ElMessageBox.alert(`<img src="${res}" class="w-[318px]" />`, { ElMessageBox.alert(`<img src="${res}" class="w-[318px]" />`, {
showClose: false, showClose: false,
@ -76,6 +80,21 @@ let open = async () => {
customClass: 'bg-modal-wrap', customClass: 'bg-modal-wrap',
}) })
} }
//
const { toClipboard } = useClipboard()
const handleCopy = async () => {
try {
await toClipboard(currentData.value?.address as string)
ElMessage({
message: 'copy success!',
type: 'success',
})
} catch (error) {
console.log(error)
}
}
</script> </script>
<style lang="scss"> <style lang="scss">

Loading…
Cancel
Save