<view>
    <u-upload             
        	ref="upload"
			:fileList="fileList"
			@afterRead="afterRead"
			@delete="deletePic"
			name="1"
			multiple
			:maxCount="1"
			width="316rpx"
			height="188rpx"
		    >
			<image class="image" src="../../static/img/sfz-a-off.png"></image>
    </u-upload>
   
    <view>
        <u-button  type="success" @click="upload">立即上传</u-button>
    </view>
  </view>

弹窗会调用两次

解决 将组件本身禁用就可以了,添加动态disabled

在u-upload中加:disabled="disabled"

data() {
		return {
			disabled: true
        }
}

触发上传

//上传按钮
		upload() {
			this.disabled = false;
			setTimeout(() => {
				this.$refs.upload.chooseFile();
			}, 100);
		},

更多推荐