uniapp plus 文件和数据上传

				const updateManage= plus.uploader.createUpload(baseUrl + '/green/url/test', {
						 method:"POST",priority:100
					}, ( t, status) => {
						console.log(t,status)
						if ( status == 200 ) { 
							console.log(t.responseText)
						} else {
							
						}
					})
					for(const itemKey in this.formOne) {
						if (itemKey === 'scheme') {
							 updateManage.addFile( this.formOne[itemKey].fullPath, {key:itemKey} );
							 // updateManage.addFile('_www/view.umd.min.js', {key:itemKey})
						} else {
							if (Array.isArray(this.formOne[itemKey])) {
								this.formOne[itemKey].forEach((itemUrl,idx) => {
									updateManage.addData(`${itemKey}[${idx}].url`, itemUrl.url);
								})
							} else {
								updateManage.addData( itemKey, this.formOne[itemKey]);
							}
						}
					}
					updateManage.setRequestHeader('Authorization',`Bearer ${uni.getStorageSync('token')}`);
					updateManage.start();

你可能感兴趣的:(uni-app,前端,javascript)