fix(Uploader): chooseFile is invalid when show-upload = false (#11218)

This commit is contained in:
Gavin 2022-11-03 21:49:16 +08:00 committed by GitHub
parent 45f7adc701
commit 20f940d6a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -301,7 +301,7 @@ export default defineComponent({
const onClickUpload = (event: MouseEvent) => emit('clickUpload', event);
const renderUpload = () => {
if (props.modelValue.length >= props.maxCount || !props.showUpload) {
if (props.modelValue.length >= props.maxCount) {
return;
}
@ -329,6 +329,7 @@ export default defineComponent({
return (
<div
v-show={props.showUpload}
class={bem('upload', { readonly: props.readonly })}
style={getSizeStyle(props.previewSize)}
onClick={onClickUpload}

View File

@ -582,7 +582,7 @@ test('show-upload prop', async () => {
expect(wrapper.find('.van-uploader__upload').exists()).toBeTruthy();
await wrapper.setProps({ showUpload: false });
expect(wrapper.find('.van-uploader__upload').exists()).toBeFalsy();
expect(wrapper.find('.van-uploader__upload').style.display).toBe('none');
});
test('file message should be reactive', (done) => {