提交 16c5d327 编写于 作者: 无木

feat(basic-upload): `value` support v-model

上级 76a5f87c
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
- **Axios** 新增`withToken`配置,用于控制请求是否携带 token - **Axios** 新增`withToken`配置,用于控制请求是否携带 token
- **BasicUpload** 新增在预览 `Modal` 中删除文件时触发`preview-delete` 事件 - **BasicUpload** 新增在预览 `Modal` 中删除文件时触发`preview-delete` 事件
- **BasicUpload** `value` 支持 `v-model` 用法
### 🐛 Bug Fixes ### 🐛 Bug Fixes
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
name: 'BasicUpload', name: 'BasicUpload',
components: { UploadModal, UploadPreviewModal, Icon, Tooltip }, components: { UploadModal, UploadPreviewModal, Icon, Tooltip },
props: uploadContainerProps, props: uploadContainerProps,
emits: ['change', 'delete', 'preview-delete'], emits: ['change', 'delete', 'preview-delete', 'update:value'],
setup(props, { emit, attrs }) { setup(props, { emit, attrs }) {
const { t } = useI18n(); const { t } = useI18n();
...@@ -85,12 +85,14 @@ ...@@ -85,12 +85,14 @@
// 上传modal保存操作 // 上传modal保存操作
function handleChange(urls: string[]) { function handleChange(urls: string[]) {
fileList.value = [...unref(fileList), ...(urls || [])]; fileList.value = [...unref(fileList), ...(urls || [])];
emit('update:value', fileList.value);
emit('change', fileList.value); emit('change', fileList.value);
} }
// 预览modal保存操作 // 预览modal保存操作
function handlePreviewChange(urls: string[]) { function handlePreviewChange(urls: string[]) {
fileList.value = [...(urls || [])]; fileList.value = [...(urls || [])];
emit('update:value', fileList.value);
emit('change', fileList.value); emit('change', fileList.value);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册