Skip to content

Commit

Permalink
fix(vue): fix file upload demo
Browse files Browse the repository at this point in the history
  • Loading branch information
cschroeter committed Apr 28, 2024
1 parent b9c009e commit f5942a8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 2 additions & 3 deletions frameworks/vue/src/components/file-upload/examples/basic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import { FileUpload } from '../..'

<template>
<FileUpload.Root :maxFiles="5">
<FileUpload.Dropzone>
<FileUpload.Label>Drag your file(s) here</FileUpload.Label>
</FileUpload.Dropzone>
<FileUpload.Label>File Upload</FileUpload.Label>
<FileUpload.Dropzone>Drop your files here</FileUpload.Dropzone>
<FileUpload.Trigger>Choose file(s)</FileUpload.Trigger>
<FileUpload.ItemGroup>
<FileUpload.Context v-slot="{ acceptedFiles }">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export interface FileUploadItemPreviewImageProps extends PolymorphicProps {}
</script>

<script setup lang="ts">
import { computed, ref } from 'vue'
import { ref } from 'vue'
import { ark } from '../factory'
import { useFileUploadContext } from './use-file-upload-context'
import { useFileUploadItemPropsContext } from './use-file-upload-item-props-context'
Expand All @@ -15,7 +15,7 @@ const fileUpload = useFileUploadContext()
const itemProps = useFileUploadItemPropsContext()
const url = ref<string>('')
computed(() => fileUpload.value.createFileUrl(itemProps.file, (src) => (url.value = src)))
fileUpload.value.createFileUrl(itemProps.file, (src) => (url.value = src))
</script>

<template>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import type { ItemProps } from '@zag-js/file-upload'
import type { PolymorphicProps } from '../factory'
import { FileUploadItemPropsProvider } from './use-file-upload-item-props-context'
export interface FileUploadItemProps extends PolymorphicProps, ItemProps {}
</script>
Expand All @@ -11,6 +12,7 @@ import { useFileUploadContext } from './use-file-upload-context'
const props = defineProps<FileUploadItemProps>()
const fileUpload = useFileUploadContext()
FileUploadItemPropsProvider(props)
</script>

<template>
Expand Down

0 comments on commit f5942a8

Please sign in to comment.