mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(Uploader): chooseFile is invalid when show-upload = false (#11221)
This commit is contained in:
parent
4297aa9888
commit
4db2ca6cd6
@ -404,7 +404,7 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
genUpload() {
|
genUpload() {
|
||||||
if (this.fileList.length >= this.maxCount || !this.showUpload) {
|
if (this.fileList.length >= this.maxCount) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,6 +446,7 @@ export default createComponent({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
v-show={this.showUpload}
|
||||||
class={bem('upload', { readonly: this.readonly })}
|
class={bem('upload', { readonly: this.readonly })}
|
||||||
style={style}
|
style={style}
|
||||||
onClick={this.onClickUpload}
|
onClick={this.onClickUpload}
|
||||||
|
@ -476,9 +476,11 @@ test('close-preview event', async () => {
|
|||||||
|
|
||||||
test('show-upload prop', () => {
|
test('show-upload prop', () => {
|
||||||
const wrapper = mount(Uploader);
|
const wrapper = mount(Uploader);
|
||||||
expect(wrapper.contains('.van-uploader__upload')).toBeTruthy();
|
|
||||||
|
const upload = wrapper.find('.van-uploader__upload');
|
||||||
|
expect(upload.element).toBeTruthy();
|
||||||
wrapper.setProps({ showUpload: false });
|
wrapper.setProps({ showUpload: false });
|
||||||
expect(wrapper.contains('.van-uploader__upload')).toBeFalsy();
|
expect(upload.element.style.display).toBe('none');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('file message should be reactive', (done) => {
|
test('file message should be reactive', (done) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user