primevue-mirror/doc/fileupload/pt/PTDoc.vue

118 lines
2.7 KiB
Vue
Raw Normal View History

2023-05-02 07:19:45 +00:00
<template>
<DocSectionText v-bind="$attrs"></DocSectionText>
<div class="card">
<FileUpload
name="demo[]"
url="./upload.php"
@upload="onAdvancedUpload($event)"
:multiple="true"
accept="image/*"
:maxFileSize="1000000"
:pt="{
content: { class: 'surface-ground' }
}"
>
<template #empty>
<p>Drag and drop files to here to upload.</p>
</template>
</FileUpload>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
code: {
2023-09-22 12:54:14 +00:00
basic: `
<FileUpload
2023-05-02 07:19:45 +00:00
name="demo[]"
url="./upload.php"
@upload="onAdvancedUpload($event)"
:multiple="true"
accept="image/*"
:maxFileSize="1000000"
:pt="{
content: { class: 'surface-ground' }
}"
>
<template #empty>
<p>Drag and drop files to here to upload.</p>
</template>
2023-10-15 09:38:39 +00:00
</FileUpload>
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2023-05-02 07:19:45 +00:00
<div class="card">
<FileUpload
name="demo[]"
url="./upload.php"
@upload="onAdvancedUpload($event)"
:multiple="true"
accept="image/*"
:maxFileSize="1000000"
:pt="{
content: { class: 'surface-ground' }
}"
>
<template #empty>
<p>Drag and drop files to here to upload.</p>
</template>
</FileUpload>
<Toast />
</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-05-02 07:19:45 +00:00
<div class="card">
<FileUpload
name="demo[]"
url="./upload.php"
@upload="onAdvancedUpload($event)"
:multiple="true"
accept="image/*"
:maxFileSize="1000000"
:pt="{
content: { class: 'surface-ground' }
}"
>
<template #empty>
<p>Drag and drop files to here to upload.</p>
</template>
</FileUpload>
<Toast />
</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-05-02 07:19:45 +00:00
}
};
},
methods: {
onAdvancedUpload() {
this.$toast.add({ severity: 'info', summary: 'Success', detail: 'File Uploaded', life: 3000 });
}
}
};
</script>