mirror of
https://github.com/rustfs/console.git
synced 2026-09-19 09:52:25 +08:00
feat: 上传
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import UploadTaskManager from '~/lib/upload-task-manager'
|
||||
|
||||
export const useUploadTaskManagerStore = defineStore('uploadTaskManager', {
|
||||
state: () => ({
|
||||
taskManager: new UploadTaskManager(useNuxtApp().$s3Client, {
|
||||
chunkSize: 5,
|
||||
maxConcurrentUploads: 6
|
||||
})
|
||||
}),
|
||||
getters: {
|
||||
tasks: (state) => state.taskManager.getTasks()
|
||||
},
|
||||
actions: {
|
||||
addFiles(files: File[], bucketName: string, prefix?: string) {
|
||||
this.taskManager.addFiles(files, bucketName, prefix)
|
||||
this.taskManager.start()
|
||||
},
|
||||
getTasks() {
|
||||
return this.taskManager.getTasks()
|
||||
},
|
||||
|
||||
removeTask(taskId: string) {
|
||||
this.taskManager.removeTask(taskId)
|
||||
},
|
||||
|
||||
clearTasks() {
|
||||
this.taskManager.clearTasks()
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user