mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-23 16:30:45 +01:00
chore: add more composables (#138)
This commit is contained in:
committed by
GitHub
parent
fef93f3198
commit
fd4b608150
@@ -128,6 +128,16 @@
|
||||
<UButton icon="i-heroicons-bell" variant="red" label="Trigger an error" @click="onNotificationClick" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="font-medium text-sm mb-1 u-text-gray-700">
|
||||
Copy text to clipboard:
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<UInput v-model="textToCopy" name="textToCopy" />
|
||||
<UButton icon="i-heroicons-document-duplicate-solid" variant="primary" label="Copy text" @click="onCopyTextClick" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="font-medium text-sm mb-1 u-text-gray-700">
|
||||
Context menu:
|
||||
@@ -230,6 +240,7 @@
|
||||
|
||||
<script setup>
|
||||
const isModalOpen = ref(false)
|
||||
const textToCopy = ref('Copied text')
|
||||
|
||||
const people = ref([
|
||||
{ id: 1, name: 'Durward Reynolds', disabled: false },
|
||||
@@ -251,7 +262,8 @@ const form = reactive({
|
||||
persons: ref([people.value[0]])
|
||||
})
|
||||
|
||||
const { $toast } = useNuxtApp()
|
||||
const toast = useToast()
|
||||
const clipboard = useCopyToClipboard()
|
||||
|
||||
const x = ref(0)
|
||||
const y = ref(0)
|
||||
@@ -346,6 +358,10 @@ const customDropdownItems = [
|
||||
]
|
||||
|
||||
const onNotificationClick = () => {
|
||||
$toast.error({ title: 'Error', description: 'This is an error message' })
|
||||
toast.error({ title: 'Error', description: 'This is an error message' })
|
||||
}
|
||||
|
||||
const onCopyTextClick = () => {
|
||||
clipboard.copy(textToCopy.value, { title: 'Text copied successfully!' })
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user