-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Optimize copy icon display and establish global copy store
- Loading branch information
1 parent
06bf6e9
commit 9a3c78e
Showing
10 changed files
with
54 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<script lang="ts" setup> | ||
import { twMerge } from 'tailwind-merge' | ||
import CopyIcon from '@/assets/icons/copy.svg' | ||
import { ClipboardStore } from '@/stores/ClipboardStore' | ||
const { text } = defineProps<{ | ||
text: string | ||
}>() | ||
</script> | ||
|
||
<template> | ||
<CopyIcon | ||
@click="ClipboardStore.copy(text)" | ||
:class=" | ||
twMerge( | ||
'hover:text-blue-primary cursor-pointer', | ||
$attrs.class as string, | ||
ClipboardStore.copiedText === text ? 'text-blue-primary' : 'text-gray-primary' | ||
) | ||
" | ||
/> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,8 @@ | ||
<script lang="ts" setup> | ||
const props = defineProps<{ | ||
class?: string | ||
}>() | ||
import { twMerge } from 'tailwind-merge' | ||
import LoadingIcon from '@/assets/icons/loading.svg' | ||
</script> | ||
|
||
<template> | ||
<svg | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
xmlns="http://www.w3.org/2000/svg" | ||
:class="['animate-spin h-5 w-5 text-white', props.class]" | ||
> | ||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle> | ||
<path | ||
class="opacity-75" | ||
fill="currentColor" | ||
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" | ||
></path> | ||
</svg> | ||
<LoadingIcon :class="twMerge('h-5 w-5 text-gray-primary', $attrs.class as string)" /> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { reactive } from 'vue' | ||
|
||
export const ClipboardStore = reactive({ | ||
copiedText: '', | ||
copy: async (text: string) => { | ||
try { | ||
await navigator.clipboard.writeText(text) | ||
ClipboardStore.copiedText = text | ||
} catch (error) { | ||
console.error('复制失败:', error) | ||
} | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { reactive, watch } from 'vue' | ||
import { reactive } from 'vue' | ||
|
||
interface NFTType { | ||
id: number | ||
|