Skip to content

Commit

Permalink
feat(basic-upload): value support v-model
Browse files Browse the repository at this point in the history
  • Loading branch information
mynetfan committed Jun 30, 2021
1 parent 76a5f87 commit 16c5d32
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- **Axios** 新增`withToken`配置,用于控制请求是否携带 token
- **BasicUpload** 新增在预览 `Modal` 中删除文件时触发`preview-delete` 事件
- **BasicUpload** `value` 支持 `v-model` 用法

### 🐛 Bug Fixes

Expand Down
4 changes: 3 additions & 1 deletion src/components/Upload/src/BasicUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
name: 'BasicUpload',
components: { UploadModal, UploadPreviewModal, Icon, Tooltip },
props: uploadContainerProps,
emits: ['change', 'delete', 'preview-delete'],
emits: ['change', 'delete', 'preview-delete', 'update:value'],
setup(props, { emit, attrs }) {
const { t } = useI18n();
Expand Down Expand Up @@ -85,12 +85,14 @@
// 上传modal保存操作
function handleChange(urls: string[]) {
fileList.value = [...unref(fileList), ...(urls || [])];
emit('update:value', fileList.value);
emit('change', fileList.value);
}
// 预览modal保存操作
function handlePreviewChange(urls: string[]) {
fileList.value = [...(urls || [])];
emit('update:value', fileList.value);
emit('change', fileList.value);
}
Expand Down

0 comments on commit 16c5d32

Please sign in to comment.