Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Convert CopyCode component to Composition API (#124)
Browse files Browse the repository at this point in the history
* Convert CopyCode component to Composition API

* ^^/
  • Loading branch information
Mysterious-Dev authored Nov 13, 2023
1 parent 9211627 commit 06d6cb6
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions lib/components/base/CopyCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,24 @@
</button>
</template>

<script setup>
<script setup lang="ts">
import { ref } from 'vue'
import { CheckIcon, ClipboardCopyIcon } from '@'
import { useVIntl, defineMessage } from '@vintl/vintl'
const copiedMessage = defineMessage({
id: 'omorphia.component.copy.action.copy',
defaultMessage: 'Copy code to clipboard',
})
const { formatMessage } = useVIntl()
</script>
<script>
export default {
props: {
text: {
type: String,
required: true,
},
},
data() {
return {
copied: false,
}
},
methods: {
async copyText() {
await navigator.clipboard.writeText(this.text)
this.copied = true
},
},
const props = defineProps<{ text: string }>()
const copied = ref(false)
async function copyText() {
await navigator.clipboard.writeText(props.text)
copied.value = true
}
</script>

Expand Down

0 comments on commit 06d6cb6

Please sign in to comment.