Skip to content

Upload 上传

Form · Interactive component

Local selection, upload hooks, and failure feedback.

On-demand importwbbb-ui/components/upload

Basic Usage

Example code
<script setup lang="ts">
import { ref } from 'vue'
import { WbbbUpload } from 'wbbb-ui/components/upload'
import type { WbbbUploadFile } from 'wbbb-ui/components/upload'

const files = ref<WbbbUploadFile[]>([])
async function uploader(file: WbbbUploadFile) {
  return { ...file, path: await uploadToBusinessServer(file.path) }
}
</script>

<template>
  <WbbbUpload v-model="files" :uploader="uploader" locale="en-US" />
</template>
Live mobile previewOpen in a new tab ↗

States and Interaction

All listed states can be operated and verified in the live Playground preview.

DefaultFilledFocusDisabledError

API Reference

Props

PropertyDescriptionTypeDefaultRequired
beforeReadRuns before file selection is accepted and can block the read.(files: WbbbUploadFile[]) => boolean \| Promise<boolean>No
countSets the number of rendered placeholder rows or items.number9No
disabledPrevents user interaction with the component.booleanfalseNo
localeOverrides the locale used for built-in display copy.WbbbLocaleInputNo
modelValueProvides the current value used by v-model.WbbbUploadFile[]() => []No
textProvides the primary display text.string由 locale 决定No
uploaderProvides the business-layer upload implementation.(file: WbbbUploadFile, options?: { signal?: AbortSignal }) => WbbbUploadFile \| Promise<WbbbUploadFile>No

Events

  • update:modelValue
  • afterRead
  • change
  • error
  • remove

Slots

None

Two-way binding

Supports v-model (modelValue).

Platform Notes

Build verification: H5, App Vue, WeChat Mini Program, Alipay Mini Program, and Douyin Mini Program.

Runtime differences: H5 supports keyboard focus and reduced motion. Mini Programs provide equivalent touch interaction; verify upload, date selection, and overlays on target platforms.

Usage note: Inject the uploader from the business layer and handle beforeRead, failures, retries, deletion, and cancellation.

Wbbb UI · Built for uni-app product experiences