primevue-mirror/apps/showcase/doc/fileupload/AdvancedDoc.vue

80 lines
2.3 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>FileUpload is an advanced uploader with dragdrop support, multi file uploads, auto uploading, progress tracking and validations.</p>
</DocSectionText>
<div class="card">
2023-10-23 14:23:28 +00:00
<FileUpload name="demo[]" url="/api/upload" @upload="onAdvancedUpload($event)" :multiple="true" accept="image/*" :maxFileSize="1000000">
2023-02-28 08:29:30 +00:00
<template #empty>
2024-04-20 12:45:44 +00:00
<span>Drag and drop files to here to upload.</span>
2023-02-28 08:29:30 +00:00
</template>
</FileUpload>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
code: {
2023-09-22 12:54:14 +00:00
basic: `
2023-10-23 14:24:55 +00:00
<FileUpload name="demo[]" url="/api/upload" @upload="onAdvancedUpload($event)" :multiple="true" accept="image/*" :maxFileSize="1000000">
2023-02-28 08:29:30 +00:00
<template #empty>
2024-04-20 12:45:44 +00:00
<span>Drag and drop files to here to upload.</span>
2023-02-28 08:29:30 +00:00
</template>
2023-10-15 09:38:39 +00:00
</FileUpload>
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2023-02-28 08:29:30 +00:00
<div class="card">
<Toast />
2023-10-23 14:24:55 +00:00
<FileUpload name="demo[]" url="/api/upload" @upload="onAdvancedUpload($event)" :multiple="true" accept="image/*" :maxFileSize="1000000">
2023-02-28 08:29:30 +00:00
<template #empty>
2024-04-20 12:45:44 +00:00
<span>Drag and drop files to here to upload.</span>
2023-02-28 08:29:30 +00:00
</template>
</FileUpload>
</div>
</template>
<script>
export default {
methods: {
onAdvancedUpload() {
this.$toast.add({ severity: 'info', summary: 'Success', detail: 'File Uploaded', life: 3000 });
}
}
};
2023-10-15 09:38:39 +00:00
<\/script>
`,
2023-09-22 12:54:14 +00:00
composition: `
<template>
2023-02-28 08:29:30 +00:00
<div class="card">
<Toast />
2023-10-23 14:24:55 +00:00
<FileUpload name="demo[]" url="/api/upload" @upload="onAdvancedUpload($event)" :multiple="true" accept="image/*" :maxFileSize="1000000">
2023-02-28 08:29:30 +00:00
<template #empty>
2024-04-20 12:45:44 +00:00
<span>Drag and drop files to here to upload.</span>
2023-02-28 08:29:30 +00:00
</template>
</FileUpload>
</div>
</template>
<script setup>
import { useToast } from "primevue/usetoast";
const toast = useToast();
const onAdvancedUpload = () => {
toast.add({ severity: 'info', summary: 'Success', detail: 'File Uploaded', life: 3000 });
};
2023-10-15 09:38:39 +00:00
<\/script>
`
2023-02-28 08:29:30 +00:00
}
};
},
methods: {
onAdvancedUpload() {
this.$toast.add({ severity: 'info', summary: 'Success', detail: 'File Uploaded', life: 3000 });
}
}
};
</script>