@vrojs/element-plus 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +16 -0
- package/dist/index.js +88 -0
- package/dist/locale/index.d.ts +3 -0
- package/dist/locale/index.js +7 -0
- package/dist/locale/lang/zh-cn.d.ts +47 -0
- package/dist/locale/lang/zh-cn.js +49 -0
- package/dist/locale/types.d.ts +7 -0
- package/dist/locale/types.js +1 -0
- package/dist/locale/useLocale.d.ts +53 -0
- package/dist/locale/useLocale.js +24 -0
- package/dist/style/css.js +4 -0
- package/dist/style/deps.js +26 -0
- package/dist/style/index.css +1 -0
- package/dist/style/index.js +30 -0
- package/dist/utils/datePickerValueFormat.d.ts +1 -0
- package/dist/utils/datePickerValueFormat.js +9 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +6 -0
- package/dist/vro-el-checkbox-group/index.d.ts +122 -0
- package/dist/vro-el-checkbox-group/index.js +9 -0
- package/dist/vro-el-checkbox-group/style/css.d.ts +0 -0
- package/dist/vro-el-checkbox-group/style/css.js +3 -0
- package/dist/vro-el-checkbox-group/style/deps.d.ts +0 -0
- package/dist/vro-el-checkbox-group/style/deps.js +2 -0
- package/dist/vro-el-checkbox-group/style/index.d.ts +0 -0
- package/dist/vro-el-checkbox-group/style/index.js +5 -0
- package/dist/vro-el-checkbox-group/types.d.ts +50 -0
- package/dist/vro-el-checkbox-group/types.js +16 -0
- package/dist/vro-el-checkbox-group/vro-el-checkbox-group.vue.d.ts +115 -0
- package/dist/vro-el-checkbox-group/vro-el-checkbox-group.vue.js +34 -0
- package/dist/vro-el-checkbox-group/vro-el-checkbox-group.vue2.js +4 -0
- package/dist/vro-el-config-provider/index.d.ts +46 -0
- package/dist/vro-el-config-provider/index.js +9 -0
- package/dist/vro-el-config-provider/style/css.d.ts +0 -0
- package/dist/vro-el-config-provider/style/css.js +3 -0
- package/dist/vro-el-config-provider/style/deps.d.ts +0 -0
- package/dist/vro-el-config-provider/style/deps.js +1 -0
- package/dist/vro-el-config-provider/style/index.d.ts +0 -0
- package/dist/vro-el-config-provider/style/index.js +3 -0
- package/dist/vro-el-config-provider/types.d.ts +14 -0
- package/dist/vro-el-config-provider/types.js +13 -0
- package/dist/vro-el-config-provider/vro-el-config-provider.vue.d.ts +29 -0
- package/dist/vro-el-config-provider/vro-el-config-provider.vue.js +17 -0
- package/dist/vro-el-config-provider/vro-el-config-provider.vue2.js +4 -0
- package/dist/vro-el-file-upload/index.d.ts +44 -0
- package/dist/vro-el-file-upload/index.js +12 -0
- package/dist/vro-el-file-upload/style/css.d.ts +0 -0
- package/dist/vro-el-file-upload/style/css.js +4 -0
- package/dist/vro-el-file-upload/style/deps.d.ts +0 -0
- package/dist/vro-el-file-upload/style/deps.js +2 -0
- package/dist/vro-el-file-upload/style/index.css +1 -0
- package/dist/vro-el-file-upload/style/index.d.ts +0 -0
- package/dist/vro-el-file-upload/style/index.js +6 -0
- package/dist/vro-el-file-upload/types.d.ts +39 -0
- package/dist/vro-el-file-upload/types.js +35 -0
- package/dist/vro-el-file-upload/utils.d.ts +2 -0
- package/dist/vro-el-file-upload/utils.js +6 -0
- package/dist/vro-el-file-upload/vro-el-file-upload.vue.d.ts +36 -0
- package/dist/vro-el-file-upload/vro-el-file-upload.vue.js +86 -0
- package/dist/vro-el-file-upload/vro-el-file-upload.vue2.js +4 -0
- package/dist/vro-el-icon/index.d.ts +82 -0
- package/dist/vro-el-icon/index.js +9 -0
- package/dist/vro-el-icon/style/css.d.ts +0 -0
- package/dist/vro-el-icon/style/css.js +3 -0
- package/dist/vro-el-icon/style/deps.d.ts +0 -0
- package/dist/vro-el-icon/style/deps.js +1 -0
- package/dist/vro-el-icon/style/index.d.ts +0 -0
- package/dist/vro-el-icon/style/index.js +4 -0
- package/dist/vro-el-icon/types.d.ts +20 -0
- package/dist/vro-el-icon/types.js +11 -0
- package/dist/vro-el-icon/vro-el-icon.vue.d.ts +53 -0
- package/dist/vro-el-icon/vro-el-icon.vue.js +33 -0
- package/dist/vro-el-icon/vro-el-icon.vue2.js +4 -0
- package/dist/vro-el-image-upload/index.d.ts +50 -0
- package/dist/vro-el-image-upload/index.js +12 -0
- package/dist/vro-el-image-upload/style/css.d.ts +0 -0
- package/dist/vro-el-image-upload/style/css.js +4 -0
- package/dist/vro-el-image-upload/style/deps.d.ts +0 -0
- package/dist/vro-el-image-upload/style/deps.js +4 -0
- package/dist/vro-el-image-upload/style/index.css +1 -0
- package/dist/vro-el-image-upload/style/index.d.ts +0 -0
- package/dist/vro-el-image-upload/style/index.js +8 -0
- package/dist/vro-el-image-upload/types.d.ts +38 -0
- package/dist/vro-el-image-upload/types.js +25 -0
- package/dist/vro-el-image-upload/utils.d.ts +2 -0
- package/dist/vro-el-image-upload/utils.js +6 -0
- package/dist/vro-el-image-upload/vro-el-image-upload.vue.d.ts +42 -0
- package/dist/vro-el-image-upload/vro-el-image-upload.vue.js +126 -0
- package/dist/vro-el-image-upload/vro-el-image-upload.vue2.js +4 -0
- package/dist/vro-el-radio-group/index.d.ts +79 -0
- package/dist/vro-el-radio-group/index.js +9 -0
- package/dist/vro-el-radio-group/style/css.d.ts +0 -0
- package/dist/vro-el-radio-group/style/css.js +3 -0
- package/dist/vro-el-radio-group/style/deps.d.ts +0 -0
- package/dist/vro-el-radio-group/style/deps.js +2 -0
- package/dist/vro-el-radio-group/style/index.d.ts +0 -0
- package/dist/vro-el-radio-group/style/index.js +5 -0
- package/dist/vro-el-radio-group/types.d.ts +38 -0
- package/dist/vro-el-radio-group/types.js +25 -0
- package/dist/vro-el-radio-group/vro-el-radio-group.vue.d.ts +72 -0
- package/dist/vro-el-radio-group/vro-el-radio-group.vue.js +34 -0
- package/dist/vro-el-radio-group/vro-el-radio-group.vue2.js +4 -0
- package/dist/vro-el-schema-filter/index.d.ts +596 -0
- package/dist/vro-el-schema-filter/index.js +9 -0
- package/dist/vro-el-schema-filter/style/css.d.ts +0 -0
- package/dist/vro-el-schema-filter/style/css.js +16 -0
- package/dist/vro-el-schema-filter/style/deps.d.ts +0 -0
- package/dist/vro-el-schema-filter/style/deps.js +22 -0
- package/dist/vro-el-schema-filter/style/index.css +1 -0
- package/dist/vro-el-schema-filter/style/index.d.ts +0 -0
- package/dist/vro-el-schema-filter/style/index.js +38 -0
- package/dist/vro-el-schema-filter/types.d.ts +41 -0
- package/dist/vro-el-schema-filter/types.js +26 -0
- package/dist/vro-el-schema-filter/vro-el-schema-filter.vue.d.ts +983 -0
- package/dist/vro-el-schema-filter/vro-el-schema-filter.vue.js +71 -0
- package/dist/vro-el-schema-filter/vro-el-schema-filter.vue2.js +4 -0
- package/dist/vro-el-schema-form/defineVroElSchemaFormCreateField.d.ts +2 -0
- package/dist/vro-el-schema-form/defineVroElSchemaFormCreateField.js +9 -0
- package/dist/vro-el-schema-form/defineVroElSchemaFormFieldTrigger.d.ts +9 -0
- package/dist/vro-el-schema-form/defineVroElSchemaFormFieldTrigger.js +6 -0
- package/dist/vro-el-schema-form/index.d.ts +563 -0
- package/dist/vro-el-schema-form/index.js +17 -0
- package/dist/vro-el-schema-form/style/css.d.ts +0 -0
- package/dist/vro-el-schema-form/style/css.js +14 -0
- package/dist/vro-el-schema-form/style/deps.d.ts +0 -0
- package/dist/vro-el-schema-form/style/deps.js +22 -0
- package/dist/vro-el-schema-form/style/index.css +1 -0
- package/dist/vro-el-schema-form/style/index.d.ts +0 -0
- package/dist/vro-el-schema-form/style/index.js +36 -0
- package/dist/vro-el-schema-form/types.d.ts +114 -0
- package/dist/vro-el-schema-form/types.js +42 -0
- package/dist/vro-el-schema-form/useVroElSchemaForm.d.ts +908 -0
- package/dist/vro-el-schema-form/useVroElSchemaForm.js +31 -0
- package/dist/vro-el-schema-form/vro-el-schema-form.vue.d.ts +391 -0
- package/dist/vro-el-schema-form/vro-el-schema-form.vue.js +120 -0
- package/dist/vro-el-schema-form/vro-el-schema-form.vue2.js +4 -0
- package/dist/vro-el-schema-form/vroElSchemaFormFieldManager.d.ts +2 -0
- package/dist/vro-el-schema-form/vroElSchemaFormFieldManager.js +32 -0
- package/dist/vro-el-schema-form-dialog/function-call.d.ts +3 -0
- package/dist/vro-el-schema-form-dialog/function-call.js +17 -0
- package/dist/vro-el-schema-form-dialog/index.d.ts +2182 -0
- package/dist/vro-el-schema-form-dialog/index.js +18 -0
- package/dist/vro-el-schema-form-dialog/injection.d.ts +9 -0
- package/dist/vro-el-schema-form-dialog/injection.js +9 -0
- package/dist/vro-el-schema-form-dialog/style/css.d.ts +0 -0
- package/dist/vro-el-schema-form-dialog/style/css.js +18 -0
- package/dist/vro-el-schema-form-dialog/style/deps.d.ts +0 -0
- package/dist/vro-el-schema-form-dialog/style/deps.js +24 -0
- package/dist/vro-el-schema-form-dialog/style/index.css +1 -0
- package/dist/vro-el-schema-form-dialog/style/index.d.ts +0 -0
- package/dist/vro-el-schema-form-dialog/style/index.js +42 -0
- package/dist/vro-el-schema-form-dialog/types.d.ts +79 -0
- package/dist/vro-el-schema-form-dialog/types.js +59 -0
- package/dist/vro-el-schema-form-dialog/useVroElSchemaFormDialog.d.ts +14 -0
- package/dist/vro-el-schema-form-dialog/useVroElSchemaFormDialog.js +18 -0
- package/dist/vro-el-schema-form-dialog/vro-el-schema-form-dialog.vue.d.ts +1794 -0
- package/dist/vro-el-schema-form-dialog/vro-el-schema-form-dialog.vue.js +135 -0
- package/dist/vro-el-schema-form-dialog/vro-el-schema-form-dialog.vue2.js +4 -0
- package/dist/vro-el-select/index.d.ts +259 -0
- package/dist/vro-el-select/index.js +9 -0
- package/dist/vro-el-select/style/css.d.ts +0 -0
- package/dist/vro-el-select/style/css.js +3 -0
- package/dist/vro-el-select/style/deps.d.ts +0 -0
- package/dist/vro-el-select/style/deps.js +2 -0
- package/dist/vro-el-select/style/index.d.ts +0 -0
- package/dist/vro-el-select/style/index.js +5 -0
- package/dist/vro-el-select/types.d.ts +105 -0
- package/dist/vro-el-select/types.js +16 -0
- package/dist/vro-el-select/vro-el-select.vue.d.ts +252 -0
- package/dist/vro-el-select/vro-el-select.vue.js +30 -0
- package/dist/vro-el-select/vro-el-select.vue2.js +4 -0
- package/dist/vro-el-skeleton/index.d.ts +154 -0
- package/dist/vro-el-skeleton/index.js +9 -0
- package/dist/vro-el-skeleton/style/css.d.ts +0 -0
- package/dist/vro-el-skeleton/style/css.js +5 -0
- package/dist/vro-el-skeleton/style/deps.d.ts +0 -0
- package/dist/vro-el-skeleton/style/deps.js +3 -0
- package/dist/vro-el-skeleton/style/index.css +1 -0
- package/dist/vro-el-skeleton/style/index.d.ts +0 -0
- package/dist/vro-el-skeleton/style/index.js +8 -0
- package/dist/vro-el-skeleton/types.d.ts +72 -0
- package/{src/vro-el-skeleton/types.ts → dist/vro-el-skeleton/types.js} +15 -29
- package/dist/vro-el-skeleton/vro-el-skeleton.vue.d.ts +95 -0
- package/dist/vro-el-skeleton/vro-el-skeleton.vue.js +85 -0
- package/dist/vro-el-skeleton/vro-el-skeleton.vue2.js +4 -0
- package/dist/vro-el-tags/index.d.ts +223 -0
- package/dist/vro-el-tags/index.js +9 -0
- package/dist/vro-el-tags/style/css.d.ts +0 -0
- package/dist/vro-el-tags/style/css.js +3 -0
- package/dist/vro-el-tags/style/deps.d.ts +0 -0
- package/dist/vro-el-tags/style/deps.js +3 -0
- package/dist/vro-el-tags/style/index.d.ts +0 -0
- package/dist/vro-el-tags/style/index.js +6 -0
- package/dist/vro-el-tags/types.d.ts +18 -0
- package/dist/vro-el-tags/types.js +19 -0
- package/dist/vro-el-tags/vro-el-tags.vue.d.ts +217 -0
- package/dist/vro-el-tags/vro-el-tags.vue.js +62 -0
- package/dist/vro-el-tags/vro-el-tags.vue2.js +4 -0
- package/dist/vro-el-tree/index.d.ts +86 -0
- package/dist/vro-el-tree/index.js +9 -0
- package/dist/vro-el-tree/style/css.d.ts +0 -0
- package/dist/vro-el-tree/style/css.js +4 -0
- package/dist/vro-el-tree/style/deps.d.ts +0 -0
- package/dist/vro-el-tree/style/deps.js +1 -0
- package/dist/vro-el-tree/style/index.css +1 -0
- package/dist/vro-el-tree/style/index.d.ts +0 -0
- package/dist/vro-el-tree/style/index.js +5 -0
- package/dist/vro-el-tree/types.d.ts +32 -0
- package/dist/vro-el-tree/types.js +26 -0
- package/dist/vro-el-tree/vro-el-tree.vue.d.ts +52 -0
- package/dist/vro-el-tree/vro-el-tree.vue.js +56 -0
- package/dist/vro-el-tree/vro-el-tree.vue2.js +4 -0
- package/dist/vro-el-with-config/index.d.ts +32 -0
- package/dist/vro-el-with-config/index.js +9 -0
- package/dist/vro-el-with-config/style/css.d.ts +0 -0
- package/dist/vro-el-with-config/style/css.js +4 -0
- package/dist/vro-el-with-config/style/deps.d.ts +0 -0
- package/dist/vro-el-with-config/style/deps.js +1 -0
- package/dist/vro-el-with-config/style/index.d.ts +0 -0
- package/dist/vro-el-with-config/style/index.js +5 -0
- package/dist/vro-el-with-config/types.d.ts +15 -0
- package/dist/vro-el-with-config/types.js +14 -0
- package/dist/vro-el-with-config/vro-el-with-config.vue.d.ts +25 -0
- package/dist/vro-el-with-config/vro-el-with-config.vue.js +32 -0
- package/dist/vro-el-with-config/vro-el-with-config.vue2.js +4 -0
- package/package.json +18 -12
- package/src/index.ts +0 -13
- package/src/locale/index.ts +0 -3
- package/src/locale/lang/zh-cn.ts +0 -22
- package/src/locale/types.ts +0 -8
- package/src/locale/useLocale.ts +0 -42
- package/src/style/base.scss +0 -2
- package/src/style/css.ts +0 -2
- package/src/style/deps.ts +0 -9
- package/src/style/index.scss +0 -12
- package/src/style/index.ts +0 -2
- package/src/utils/datePickerValueFormat.ts +0 -6
- package/src/utils/index.ts +0 -2
- package/src/vro-el-checkbox-group/README.md +0 -83
- package/src/vro-el-checkbox-group/index.ts +0 -16
- package/src/vro-el-checkbox-group/style/css.ts +0 -2
- package/src/vro-el-checkbox-group/style/deps.ts +0 -2
- package/src/vro-el-checkbox-group/style/index.scss +0 -1
- package/src/vro-el-checkbox-group/style/index.ts +0 -2
- package/src/vro-el-checkbox-group/types.ts +0 -18
- package/src/vro-el-checkbox-group/vro-el-checkbox-group.vue +0 -33
- package/src/vro-el-config-provider/README.md +0 -65
- package/src/vro-el-config-provider/index.ts +0 -16
- package/src/vro-el-config-provider/style/css.ts +0 -2
- package/src/vro-el-config-provider/style/index.ts +0 -2
- package/src/vro-el-config-provider/types.ts +0 -18
- package/src/vro-el-config-provider/vro-el-config-provider.vue +0 -19
- package/src/vro-el-file-upload/README.md +0 -89
- package/src/vro-el-file-upload/index.ts +0 -17
- package/src/vro-el-file-upload/style/css.ts +0 -2
- package/src/vro-el-file-upload/style/deps.ts +0 -2
- package/src/vro-el-file-upload/style/index.scss +0 -30
- package/src/vro-el-file-upload/style/index.ts +0 -2
- package/src/vro-el-file-upload/types.ts +0 -50
- package/src/vro-el-file-upload/utils.ts +0 -7
- package/src/vro-el-file-upload/vro-el-file-upload.vue +0 -95
- package/src/vro-el-icon/README.md +0 -68
- package/src/vro-el-icon/index.ts +0 -16
- package/src/vro-el-icon/style/css.ts +0 -2
- package/src/vro-el-icon/style/deps.ts +0 -1
- package/src/vro-el-icon/style/index.scss +0 -1
- package/src/vro-el-icon/style/index.ts +0 -2
- package/src/vro-el-icon/types.ts +0 -12
- package/src/vro-el-icon/vro-el-icon.vue +0 -28
- package/src/vro-el-image-upload/README.md +0 -99
- package/src/vro-el-image-upload/index.ts +0 -17
- package/src/vro-el-image-upload/style/css.ts +0 -2
- package/src/vro-el-image-upload/style/deps.ts +0 -4
- package/src/vro-el-image-upload/style/index.scss +0 -55
- package/src/vro-el-image-upload/style/index.ts +0 -2
- package/src/vro-el-image-upload/types.ts +0 -42
- package/src/vro-el-image-upload/utils.ts +0 -7
- package/src/vro-el-image-upload/vro-el-image-upload.vue +0 -134
- package/src/vro-el-schema-form-dialog/README.md +0 -64
- package/src/vro-el-schema-form-dialog/function-call.ts +0 -12
- package/src/vro-el-schema-form-dialog/index.ts +0 -17
- package/src/vro-el-schema-form-dialog/style/css.ts +0 -2
- package/src/vro-el-schema-form-dialog/style/index.scss +0 -1
- package/src/vro-el-schema-form-dialog/style/index.ts +0 -2
- package/src/vro-el-schema-form-dialog/types.ts +0 -5
- package/src/vro-el-schema-form-dialog/vro-el-schema-form-dialog.vue +0 -32
- package/src/vro-el-select/README.md +0 -83
- package/src/vro-el-select/index.ts +0 -16
- package/src/vro-el-select/style/css.ts +0 -2
- package/src/vro-el-select/style/deps.ts +0 -2
- package/src/vro-el-select/style/index.scss +0 -1
- package/src/vro-el-select/style/index.ts +0 -2
- package/src/vro-el-select/types.ts +0 -18
- package/src/vro-el-select/vro-el-select.vue +0 -33
- package/src/vro-el-skeleton/README.md +0 -128
- package/src/vro-el-skeleton/index.ts +0 -16
- package/src/vro-el-skeleton/style/css.ts +0 -3
- package/src/vro-el-skeleton/style/deps.ts +0 -3
- package/src/vro-el-skeleton/style/index.scss +0 -24
- package/src/vro-el-skeleton/style/index.ts +0 -2
- package/src/vro-el-skeleton/vro-el-skeleton.vue +0 -73
- package/src/vro-el-with-config/README.md +0 -75
- package/src/vro-el-with-config/index.ts +0 -16
- package/src/vro-el-with-config/style/css.ts +0 -3
- package/src/vro-el-with-config/style/deps.ts +0 -2
- package/src/vro-el-with-config/style/index.ts +0 -2
- package/src/vro-el-with-config/types.ts +0 -18
- package/src/vro-el-with-config/vro-el-with-config.vue +0 -48
- /package/{src/vro-el-config-provider/style/deps.ts → dist/style/base.css} +0 -0
- /package/{src/vro-el-config-provider/style/index.scss → dist/style/css.d.ts} +0 -0
- /package/{src/vro-el-schema-form-dialog/style/deps.ts → dist/style/deps.d.ts} +0 -0
- /package/{src/vro-el-with-config/style/index.scss → dist/style/index.d.ts} +0 -0
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
# VroElFileUpload
|
|
2
|
-
|
|
3
|
-
### 介绍
|
|
4
|
-
|
|
5
|
-
基于 Element Plus Button 的轻量文件上传组件。组件只负责选择文件、展示已上传地址和删除交互,实际上传逻辑由 `upload` 回调提供。
|
|
6
|
-
|
|
7
|
-
## 代码演示
|
|
8
|
-
|
|
9
|
-
### 基础用法
|
|
10
|
-
|
|
11
|
-
```html
|
|
12
|
-
<template>
|
|
13
|
-
<vro-el-file-upload v-model="value" :upload="upload" />
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<script setup lang="ts">
|
|
17
|
-
import { ref } from 'vue'
|
|
18
|
-
|
|
19
|
-
const value = ref('')
|
|
20
|
-
|
|
21
|
-
const upload = async (files: File[]) => {
|
|
22
|
-
return files.map((file) => URL.createObjectURL(file))
|
|
23
|
-
}
|
|
24
|
-
</script>
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### 多文件上传
|
|
28
|
-
|
|
29
|
-
```html
|
|
30
|
-
<vro-el-file-upload v-model="value" :max="3" :upload="upload" />
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### 全局上传配置
|
|
34
|
-
|
|
35
|
-
```ts
|
|
36
|
-
import { setVroElFileUploadOptions } from '@vrojs/element-plus'
|
|
37
|
-
|
|
38
|
-
setVroElFileUploadOptions({
|
|
39
|
-
upload: async (files, { params }) => {
|
|
40
|
-
return files.map((file) => `${params.domain}/${file.name}`)
|
|
41
|
-
},
|
|
42
|
-
})
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## API
|
|
46
|
-
|
|
47
|
-
### 属性 Props
|
|
48
|
-
|
|
49
|
-
<table>
|
|
50
|
-
<tbody>
|
|
51
|
-
<tr>
|
|
52
|
-
<td>名称</td>
|
|
53
|
-
<td>类型</td>
|
|
54
|
-
<td>默认值</td>
|
|
55
|
-
</tr>
|
|
56
|
-
<tr v-for="(item, key) in vroElFileUploadProps" :key="key">
|
|
57
|
-
<td>{{ key }}</td>
|
|
58
|
-
<td>{{ parseType(item.type || item) }}</td>
|
|
59
|
-
<td>{{ reserve(item.default, '-') }}</td>
|
|
60
|
-
</tr>
|
|
61
|
-
</tbody>
|
|
62
|
-
</table>
|
|
63
|
-
|
|
64
|
-
### 插槽 Slots
|
|
65
|
-
|
|
66
|
-
暂无。
|
|
67
|
-
|
|
68
|
-
### 事件 Events
|
|
69
|
-
|
|
70
|
-
<table>
|
|
71
|
-
<tbody>
|
|
72
|
-
<tr>
|
|
73
|
-
<td>名称</td>
|
|
74
|
-
<td>参数</td>
|
|
75
|
-
<td>说明</td>
|
|
76
|
-
</tr>
|
|
77
|
-
<tr>
|
|
78
|
-
<td>update:modelValue</td>
|
|
79
|
-
<td>value: string | string[]</td>
|
|
80
|
-
<td>上传或删除后触发</td>
|
|
81
|
-
</tr>
|
|
82
|
-
</tbody>
|
|
83
|
-
</table>
|
|
84
|
-
|
|
85
|
-
<script setup lang="ts">
|
|
86
|
-
import { reserve } from '@daysnap/utils'
|
|
87
|
-
import { VroElFileUpload, vroElFileUploadProps } from '.'
|
|
88
|
-
import { parseType } from '../utils'
|
|
89
|
-
</script>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { withInstall } from '@vrojs/base'
|
|
2
|
-
|
|
3
|
-
import Component from './vro-el-file-upload.vue'
|
|
4
|
-
|
|
5
|
-
export * from './types'
|
|
6
|
-
export * from './utils'
|
|
7
|
-
|
|
8
|
-
export const VroElFileUpload = withInstall<typeof Component>(Component)
|
|
9
|
-
export default VroElFileUpload
|
|
10
|
-
|
|
11
|
-
export type VroElFileUploadInstance = InstanceType<typeof VroElFileUpload>
|
|
12
|
-
|
|
13
|
-
declare module 'vue' {
|
|
14
|
-
export interface GlobalComponents {
|
|
15
|
-
VroElFileUpload: typeof VroElFileUpload
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
.vro-el-file-upload-btn {
|
|
2
|
-
position: relative;
|
|
3
|
-
input {
|
|
4
|
-
position: absolute;
|
|
5
|
-
width: 100%;
|
|
6
|
-
height: 100%;
|
|
7
|
-
top: 0;
|
|
8
|
-
left: 0;
|
|
9
|
-
cursor: pointer;
|
|
10
|
-
opacity: 0;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
.vro-el-file-upload-item {
|
|
14
|
-
position: relative;
|
|
15
|
-
box-sizing: border-box;
|
|
16
|
-
display: flex;
|
|
17
|
-
align-items: center;
|
|
18
|
-
margin-top: 4px;
|
|
19
|
-
a {
|
|
20
|
-
text-decoration: underline;
|
|
21
|
-
color: #007bee;
|
|
22
|
-
margin-right: 10px;
|
|
23
|
-
}
|
|
24
|
-
i {
|
|
25
|
-
cursor: pointer;
|
|
26
|
-
margin-right: 10px;
|
|
27
|
-
color: #ee0000;
|
|
28
|
-
background-color: #f2f2f2;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { ExtractPropTypes, PropType } from 'vue'
|
|
2
|
-
|
|
3
|
-
export interface VroElFileUploadCallback<T = any> {
|
|
4
|
-
(
|
|
5
|
-
files: File[],
|
|
6
|
-
options: {
|
|
7
|
-
params: T
|
|
8
|
-
},
|
|
9
|
-
): Promise<string[]>
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const vroElFileUploadProps = {
|
|
13
|
-
/**
|
|
14
|
-
* 绑定值。单文件时可传字符串,多文件时传字符串数组。
|
|
15
|
-
*/
|
|
16
|
-
modelValue: {
|
|
17
|
-
type: [String, Array] as PropType<string | string[]>,
|
|
18
|
-
default: '',
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* 原生文件选择 accept 属性。
|
|
23
|
-
*/
|
|
24
|
-
accept: String,
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* 最大上传数量。
|
|
28
|
-
*/
|
|
29
|
-
max: {
|
|
30
|
-
type: Number,
|
|
31
|
-
default: 1,
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* 是否禁用上传和删除。
|
|
36
|
-
*/
|
|
37
|
-
disabled: Boolean,
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* 上传时透传给 upload 回调的自定义参数。
|
|
41
|
-
*/
|
|
42
|
-
params: Object as PropType<Record<string, any>>,
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* 上传回调,接收本次选择的文件列表,返回文件访问地址列表。
|
|
46
|
-
*/
|
|
47
|
-
upload: Function as PropType<VroElFileUploadCallback>,
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export type VroElFileUploadProps = ExtractPropTypes<typeof vroElFileUploadProps>
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="vro-el-file-upload">
|
|
3
|
-
<el-button
|
|
4
|
-
v-if="computeValue.length < max && !disabled"
|
|
5
|
-
class="vro-el-file-upload-btn"
|
|
6
|
-
:loading="loading"
|
|
7
|
-
:disabled="disabled"
|
|
8
|
-
type="primary"
|
|
9
|
-
icon="upload"
|
|
10
|
-
>
|
|
11
|
-
{{ t('fileUpload.btnText') }}
|
|
12
|
-
<input type="file" :accept="accept" :multiple="max > 1" @change="handleUpload" />
|
|
13
|
-
</el-button>
|
|
14
|
-
|
|
15
|
-
<ul class="vro-el-file-upload-content">
|
|
16
|
-
<li class="vro-el-file-upload-item" v-for="(item, index) in computeValue" :key="index">
|
|
17
|
-
<a :href="item" target="_blank">{{ item }}</a>
|
|
18
|
-
<el-icon v-if="!disabled" @click="handleDelete(index)">
|
|
19
|
-
<circle-close-filled />
|
|
20
|
-
</el-icon>
|
|
21
|
-
</li>
|
|
22
|
-
</ul>
|
|
23
|
-
</div>
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
|
-
<script setup lang="ts">
|
|
27
|
-
import { isArray, isUndefined, omitBy } from '@daysnap/utils'
|
|
28
|
-
import { CircleCloseFilled } from '@element-plus/icons-vue'
|
|
29
|
-
import { useAsyncTask } from '@vrojs/use'
|
|
30
|
-
import { ElButton, ElIcon } from 'element-plus'
|
|
31
|
-
import { computed } from 'vue'
|
|
32
|
-
|
|
33
|
-
import { useLocale } from '../locale'
|
|
34
|
-
import { type VroElFileUploadProps, vroElFileUploadProps } from './types'
|
|
35
|
-
import { getVroElFileUploadOptions } from './utils'
|
|
36
|
-
|
|
37
|
-
defineOptions({ name: 'VroElFileUpload' })
|
|
38
|
-
|
|
39
|
-
const emit = defineEmits<{
|
|
40
|
-
(event: 'update:modelValue', value: string | string[]): void
|
|
41
|
-
}>()
|
|
42
|
-
|
|
43
|
-
const rawProps = defineProps(vroElFileUploadProps)
|
|
44
|
-
|
|
45
|
-
const { t } = useLocale()
|
|
46
|
-
|
|
47
|
-
const props = computed(() => {
|
|
48
|
-
return {
|
|
49
|
-
...getVroElFileUploadOptions(),
|
|
50
|
-
...omitBy(rawProps, isUndefined),
|
|
51
|
-
} as VroElFileUploadProps
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
const computeValue = computed(() => {
|
|
55
|
-
const { modelValue } = props.value
|
|
56
|
-
return isArray(modelValue) ? modelValue : modelValue ? [modelValue] : []
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
const handleDelete = (index: number) => {
|
|
60
|
-
let value: string | string[] = ''
|
|
61
|
-
if (isArray(props.value.modelValue)) {
|
|
62
|
-
value = [...props.value.modelValue]
|
|
63
|
-
value.splice(index, 1)
|
|
64
|
-
}
|
|
65
|
-
emit('update:modelValue', value)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const { loading, trigger: handleUpload } = useAsyncTask(
|
|
69
|
-
async (event: Event) => {
|
|
70
|
-
const target = event.target as HTMLInputElement
|
|
71
|
-
const files = Array.from(target.files ?? [])
|
|
72
|
-
target.value = ''
|
|
73
|
-
if (!files?.length) {
|
|
74
|
-
return
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const { modelValue, max, upload, params } = props.value
|
|
78
|
-
|
|
79
|
-
if (!upload) {
|
|
80
|
-
throw new Error('not set upload')
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const res = await upload(files.slice(0, max - computeValue.value.length), { params })
|
|
84
|
-
|
|
85
|
-
let value: string | string[] = res[0]
|
|
86
|
-
if (isArray(modelValue)) {
|
|
87
|
-
value = [...modelValue, ...res]
|
|
88
|
-
}
|
|
89
|
-
emit('update:modelValue', value)
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
throwError: true,
|
|
93
|
-
},
|
|
94
|
-
)
|
|
95
|
-
</script>
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# VroElIcon
|
|
2
|
-
|
|
3
|
-
### 介绍
|
|
4
|
-
|
|
5
|
-
基于 `ElIcon` 的图标封装。`name` 传入 Element Plus 图标组件或大写组件名时按组件渲染,传入普通字符串时按 `iconfont` 类名渲染。
|
|
6
|
-
|
|
7
|
-
## 代码演示
|
|
8
|
-
|
|
9
|
-
### 基础用法
|
|
10
|
-
|
|
11
|
-
```html
|
|
12
|
-
<template>
|
|
13
|
-
<vro-el-icon :name="Search" />
|
|
14
|
-
<vro-el-icon name="icon-search" />
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
<script setup lang="ts">
|
|
18
|
-
import { Search } from '@element-plus/icons-vue'
|
|
19
|
-
</script>
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
### 使用插槽
|
|
23
|
-
|
|
24
|
-
```html
|
|
25
|
-
<vro-el-icon>
|
|
26
|
-
<search />
|
|
27
|
-
</vro-el-icon>
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## API
|
|
31
|
-
|
|
32
|
-
### 属性 Props
|
|
33
|
-
|
|
34
|
-
<table>
|
|
35
|
-
<tbody>
|
|
36
|
-
<tr>
|
|
37
|
-
<td>名称</td>
|
|
38
|
-
<td>类型</td>
|
|
39
|
-
<td>默认值</td>
|
|
40
|
-
</tr>
|
|
41
|
-
<tr v-for="(item, key) in vroElIconProps" :key="key">
|
|
42
|
-
<td>{{ key }}</td>
|
|
43
|
-
<td>{{ parseType(item.type || item) }}</td>
|
|
44
|
-
<td>{{ reserve(item.default, '-') }}</td>
|
|
45
|
-
</tr>
|
|
46
|
-
</tbody>
|
|
47
|
-
</table>
|
|
48
|
-
|
|
49
|
-
### 插槽 Slots
|
|
50
|
-
|
|
51
|
-
<table>
|
|
52
|
-
<tbody>
|
|
53
|
-
<tr>
|
|
54
|
-
<td>名称</td>
|
|
55
|
-
<td>说明</td>
|
|
56
|
-
</tr>
|
|
57
|
-
<tr>
|
|
58
|
-
<td>default</td>
|
|
59
|
-
<td>自定义图标内容</td>
|
|
60
|
-
</tr>
|
|
61
|
-
</tbody>
|
|
62
|
-
</table>
|
|
63
|
-
|
|
64
|
-
<script setup lang="ts">
|
|
65
|
-
import { reserve } from '@daysnap/utils'
|
|
66
|
-
import { VroElIcon, vroElIconProps } from '.'
|
|
67
|
-
import { parseType } from '../utils'
|
|
68
|
-
</script>
|
package/src/vro-el-icon/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { withInstall } from '@vrojs/base'
|
|
2
|
-
|
|
3
|
-
import Component from './vro-el-icon.vue'
|
|
4
|
-
|
|
5
|
-
export * from './types'
|
|
6
|
-
|
|
7
|
-
export const VroElIcon = withInstall<typeof Component>(Component)
|
|
8
|
-
export default VroElIcon
|
|
9
|
-
|
|
10
|
-
export type VroElIconInstance = InstanceType<typeof VroElIcon>
|
|
11
|
-
|
|
12
|
-
declare module 'vue' {
|
|
13
|
-
export interface GlobalComponents {
|
|
14
|
-
VroElIcon: typeof VroElIcon
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import 'element-plus/es/components/icon/style/css'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.vro-el-icon { }
|
package/src/vro-el-icon/types.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { iconProps } from 'element-plus'
|
|
2
|
-
import type { ExtractPropTypes, PropType, Raw } from 'vue'
|
|
3
|
-
|
|
4
|
-
export const vroElIconProps = {
|
|
5
|
-
...iconProps,
|
|
6
|
-
name: {
|
|
7
|
-
type: [String, Object] as PropType<string | Raw<object>>,
|
|
8
|
-
default: '',
|
|
9
|
-
},
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type VroElIconProps = ExtractPropTypes<typeof vroElIconProps>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-icon class="vro-el-icon" v-bind="props">
|
|
3
|
-
<slot>
|
|
4
|
-
<component v-if="isElement" :is="name" />
|
|
5
|
-
<i v-else class="iconfont" :class="[name]"></i>
|
|
6
|
-
</slot>
|
|
7
|
-
</el-icon>
|
|
8
|
-
</template>
|
|
9
|
-
|
|
10
|
-
<script setup lang="ts">
|
|
11
|
-
import { isString } from '@daysnap/utils'
|
|
12
|
-
import { ElIcon } from 'element-plus'
|
|
13
|
-
import { computed } from 'vue'
|
|
14
|
-
|
|
15
|
-
import { vroElIconProps } from './types'
|
|
16
|
-
|
|
17
|
-
defineOptions({ name: 'VroElIcon' })
|
|
18
|
-
const props = defineProps(vroElIconProps)
|
|
19
|
-
|
|
20
|
-
const isElement = computed(() => {
|
|
21
|
-
const { name } = props
|
|
22
|
-
if (isString(name)) {
|
|
23
|
-
const char = name.substring(0, 1)
|
|
24
|
-
return char >= 'A' && char <= 'Z'
|
|
25
|
-
}
|
|
26
|
-
return true
|
|
27
|
-
})
|
|
28
|
-
</script>
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
# VroElImageUpload
|
|
2
|
-
|
|
3
|
-
### 介绍
|
|
4
|
-
|
|
5
|
-
基于 Element Plus Image 的图片上传组件。组件负责图片选择、预览、删除和拖拽排序,实际上传逻辑由 `upload` 回调提供。
|
|
6
|
-
|
|
7
|
-
## 代码演示
|
|
8
|
-
|
|
9
|
-
### 基础用法
|
|
10
|
-
|
|
11
|
-
```html
|
|
12
|
-
<template>
|
|
13
|
-
<vro-el-image-upload v-model="value" :upload="upload" />
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<script setup lang="ts">
|
|
17
|
-
import { ref } from 'vue'
|
|
18
|
-
|
|
19
|
-
const value = ref('')
|
|
20
|
-
|
|
21
|
-
const upload = async (files: File[]) => {
|
|
22
|
-
return files.map((file) => URL.createObjectURL(file))
|
|
23
|
-
}
|
|
24
|
-
</script>
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### 多图上传
|
|
28
|
-
|
|
29
|
-
```html
|
|
30
|
-
<vro-el-image-upload v-model="value" :max="3" :upload="upload" />
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### 图片压缩
|
|
34
|
-
|
|
35
|
-
```html
|
|
36
|
-
<vro-el-image-upload v-model="value" compressible :upload="upload" />
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### 全局上传配置
|
|
40
|
-
|
|
41
|
-
```ts
|
|
42
|
-
import { setVroElImageUploadOptions } from '@vrojs/element-plus'
|
|
43
|
-
|
|
44
|
-
setVroElImageUploadOptions({
|
|
45
|
-
compressible: false,
|
|
46
|
-
imageProps: {
|
|
47
|
-
fit: 'cover',
|
|
48
|
-
},
|
|
49
|
-
upload: async (files, { compress, params }) => {
|
|
50
|
-
return files.map((file) => `${params.domain}/${compress ? 'compressed' : 'raw'}/${file.name}`)
|
|
51
|
-
},
|
|
52
|
-
})
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## API
|
|
56
|
-
|
|
57
|
-
### 属性 Props
|
|
58
|
-
|
|
59
|
-
<table>
|
|
60
|
-
<tbody>
|
|
61
|
-
<tr>
|
|
62
|
-
<td>名称</td>
|
|
63
|
-
<td>类型</td>
|
|
64
|
-
<td>默认值</td>
|
|
65
|
-
</tr>
|
|
66
|
-
<tr v-for="(item, key) in vroElImageUploadProps" :key="key">
|
|
67
|
-
<td>{{ key }}</td>
|
|
68
|
-
<td>{{ parseType(item.type || item) }}</td>
|
|
69
|
-
<td>{{ reserve(item.default, '-') }}</td>
|
|
70
|
-
</tr>
|
|
71
|
-
</tbody>
|
|
72
|
-
</table>
|
|
73
|
-
|
|
74
|
-
### 插槽 Slots
|
|
75
|
-
|
|
76
|
-
暂无。
|
|
77
|
-
|
|
78
|
-
### 事件 Events
|
|
79
|
-
|
|
80
|
-
<table>
|
|
81
|
-
<tbody>
|
|
82
|
-
<tr>
|
|
83
|
-
<td>名称</td>
|
|
84
|
-
<td>参数</td>
|
|
85
|
-
<td>说明</td>
|
|
86
|
-
</tr>
|
|
87
|
-
<tr>
|
|
88
|
-
<td>update:modelValue</td>
|
|
89
|
-
<td>value: string | string[]</td>
|
|
90
|
-
<td>上传、删除或排序后触发</td>
|
|
91
|
-
</tr>
|
|
92
|
-
</tbody>
|
|
93
|
-
</table>
|
|
94
|
-
|
|
95
|
-
<script setup lang="ts">
|
|
96
|
-
import { reserve } from '@daysnap/utils'
|
|
97
|
-
import { VroElImageUpload, vroElImageUploadProps } from '.'
|
|
98
|
-
import { parseType } from '../utils'
|
|
99
|
-
</script>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { withInstall } from '@vrojs/base'
|
|
2
|
-
|
|
3
|
-
import Component from './vro-el-image-upload.vue'
|
|
4
|
-
|
|
5
|
-
export * from './types'
|
|
6
|
-
export * from './utils'
|
|
7
|
-
|
|
8
|
-
export const VroElImageUpload = withInstall<typeof Component>(Component)
|
|
9
|
-
export default VroElImageUpload
|
|
10
|
-
|
|
11
|
-
export type VroElImageUploadInstance = InstanceType<typeof VroElImageUpload>
|
|
12
|
-
|
|
13
|
-
declare module 'vue' {
|
|
14
|
-
export interface GlobalComponents {
|
|
15
|
-
VroElImageUpload: typeof VroElImageUpload
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
.vro-el-image-upload-content {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-wrap: wrap;
|
|
4
|
-
margin-top: -10px;
|
|
5
|
-
}
|
|
6
|
-
.vro-el-image-upload-item {
|
|
7
|
-
cursor: pointer;
|
|
8
|
-
position: relative;
|
|
9
|
-
box-sizing: border-box;
|
|
10
|
-
display: flex;
|
|
11
|
-
align-items: center;
|
|
12
|
-
justify-content: center;
|
|
13
|
-
margin-top: 10px;
|
|
14
|
-
margin-right: 10px;
|
|
15
|
-
font-size: 24px;
|
|
16
|
-
border-radius: 4px;
|
|
17
|
-
width: 100px;
|
|
18
|
-
height: 100px;
|
|
19
|
-
border: 1px #ccc dashed;
|
|
20
|
-
.vro-el-image-upload-image,
|
|
21
|
-
img {
|
|
22
|
-
position: absolute;
|
|
23
|
-
width: 100%;
|
|
24
|
-
height: 100%;
|
|
25
|
-
top: 0;
|
|
26
|
-
left: 0;
|
|
27
|
-
object-position: center;
|
|
28
|
-
object-fit: cover;
|
|
29
|
-
border-radius: 4px;
|
|
30
|
-
transform: translate3d(0, 0, 0);
|
|
31
|
-
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAgMAAABinRfyAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAlQTFRFyMjI////1tbWF77ztQAAABZJREFUeJxjYGAIDWUggggNbWAgggAA918Ooanz2WEAAAAASUVORK5CYII=)
|
|
32
|
-
center !important;
|
|
33
|
-
background-size: j(8) !important;
|
|
34
|
-
}
|
|
35
|
-
input {
|
|
36
|
-
cursor: pointer;
|
|
37
|
-
position: absolute;
|
|
38
|
-
top: 0;
|
|
39
|
-
left: 0;
|
|
40
|
-
width: 100%;
|
|
41
|
-
height: 100%;
|
|
42
|
-
border-radius: 4px;
|
|
43
|
-
opacity: 0;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
.vro-el-image-upload-clear {
|
|
47
|
-
position: absolute;
|
|
48
|
-
color: #fff;
|
|
49
|
-
border-radius: 50%;
|
|
50
|
-
cursor: pointer;
|
|
51
|
-
font-size: 20px;
|
|
52
|
-
right: -6px;
|
|
53
|
-
top: -6px;
|
|
54
|
-
background: red;
|
|
55
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { ElImage } from 'element-plus'
|
|
2
|
-
import type { ExtractPropTypes, PropType } from 'vue'
|
|
3
|
-
|
|
4
|
-
export type VroElImageUploadImageProps = InstanceType<typeof ElImage>['$props']
|
|
5
|
-
|
|
6
|
-
export interface VroElImageUploadCallback<T = any> {
|
|
7
|
-
(
|
|
8
|
-
/** 当前待上传的图片文件列表 */
|
|
9
|
-
files: File[],
|
|
10
|
-
options: {
|
|
11
|
-
/** 是否开启压缩 */
|
|
12
|
-
compress: boolean
|
|
13
|
-
/** 上传时透传的自定义参数 */
|
|
14
|
-
params: T
|
|
15
|
-
},
|
|
16
|
-
): Promise<string[]>
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const vroElImageUploadProps = {
|
|
20
|
-
/** 绑定值,字符串为单图模式,数组为多图模式 */
|
|
21
|
-
modelValue: {
|
|
22
|
-
type: [String, Array] as PropType<string | string[]>,
|
|
23
|
-
default: '',
|
|
24
|
-
},
|
|
25
|
-
/** 最多可上传的图片数量 */
|
|
26
|
-
max: {
|
|
27
|
-
type: Number,
|
|
28
|
-
default: 1,
|
|
29
|
-
},
|
|
30
|
-
/** 是否禁用上传、删除和排序 */
|
|
31
|
-
disabled: Boolean,
|
|
32
|
-
/** 是否显示压缩开关,传入对象时可作为响应式默认值 */
|
|
33
|
-
compressible: [Boolean, Object] as PropType<boolean | { value: boolean }>,
|
|
34
|
-
/** 上传时透传给 upload 回调的自定义参数 */
|
|
35
|
-
params: Object as PropType<Record<string, any>>,
|
|
36
|
-
/** 透传给 Element Plus Image 的属性 */
|
|
37
|
-
imageProps: Object as PropType<Partial<VroElImageUploadImageProps>>,
|
|
38
|
-
/** 自定义上传方法,需要返回图片访问地址列表 */
|
|
39
|
-
upload: Function as PropType<VroElImageUploadCallback>,
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export type VroElImageUploadProps = ExtractPropTypes<typeof vroElImageUploadProps>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { createFactory } from '@daysnap/utils'
|
|
2
|
-
|
|
3
|
-
import type { VroElImageUploadProps } from './types'
|
|
4
|
-
|
|
5
|
-
export const [setVroElImageUploadOptions, getVroElImageUploadOptions] = createFactory<
|
|
6
|
-
Partial<Pick<VroElImageUploadProps, 'compressible' | 'upload' | 'imageProps'>>
|
|
7
|
-
>({})
|