generated from dwd/boilarplate-astro-tailwind
37 lines
1.1 KiB
Vue
37 lines
1.1 KiB
Vue
<template>
|
|
<!-- <button @click="uploadFile">Upload a file...</button> -->
|
|
</template>
|
|
|
|
<!-- <script lang="ts">
|
|
import { openUploadModal } from "@bytescale/upload-widget-vue";
|
|
import type { UploadWidgetConfig, UploadWidgetResult } from "@bytescale/upload-widget";
|
|
import type { PreventableEvent } from "@bytescale/upload-widget-vue";
|
|
|
|
// -----
|
|
// Configuration:
|
|
// https://www.bytescale.com/docs/upload-widget#configuration
|
|
// -----
|
|
const options: UploadWidgetConfig = {
|
|
apiKey: "public_W142iS49Lc7EEN1moVR4ekPmkG13", // Get API key: https://www.bytescale.com/get-started
|
|
maxFileCount: 10
|
|
};
|
|
|
|
export default {
|
|
name: "App",
|
|
methods: {
|
|
uploadFile(event: PreventableEvent) {
|
|
openUploadModal({
|
|
event,
|
|
options,
|
|
onComplete: (files: UploadWidgetResult[]) => {
|
|
if (files.length === 0) {
|
|
alert("No files selected.");
|
|
} else {
|
|
alert(files.map(f => f.fileUrl).join("\n"));
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
};
|
|
</script> --> |