| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- /* eslint-disable @typescript-eslint/no-unused-vars */
- import type { CSSProperties } from 'vue'
- import type { UploadItem } from './types'
- import type { ProgressProps } from 'element-plus'
- export const imageUploadProps = {
- // 已上传列表
- modelValue: {
- type: Array as PropType<UploadItem[]>,
- required: true
- },
- // 是否自动上传
- autoUpload: {
- type: Boolean,
- default: true
- },
- // 是否启用拖拽上传
- drag: Boolean,
- // 是否只读
- readonly: Boolean,
- // 是否禁用
- disabled: Boolean,
- // 是否点击预览
- preview: {
- type: Boolean,
- default: true
- },
- // 可上传数量
- limit: {
- type: Number,
- default: 5
- },
- // 是否支持多选
- multiple: {
- type: Boolean,
- default: false
- },
- // 上传类型
- accept: {
- type: String,
- default: 'image/png,image/jpeg'
- },
- // 文件大小限制(MB)
- fileSize: {
- type: Number,
- default: 1024 * 5
- },
- // item 样式
- itemStyle: Object as PropType<string | CSSProperties>,
- // 上传按钮样式
- buttonStyle: Object as PropType<string | CSSProperties>,
- // 上传进度条配置
- progressProps: Object as PropType<ProgressProps>,
- // 上传方法 // ToDo: 上传是否可以使用utils 中的 oss 上传方法
- uploadFunction: {
- type: Function as PropType<(file: any) => Promise<any>>,
- required: true
- }
- }
- export type ImageUploadProps = ExtractPropTypes<typeof imageUploadProps>
- /* 事件 */
- export const imageUploadEmits = {
- // 上传事件
- upload: (_value: UploadItem) => true,
- // 单个删除事件
- remove: (_value: UploadItem) => true,
- // 修改modelValue
- 'update:modelValue': (_value: UploadItem[]) => true
- }
|