handleOutPut() { const searchData=this.state.searchData; let url = commonData.baseMerchantUrl + "/order/merchant/list/export?"; const keys = Object.keys( searchData ); let flag = true; keys.forEach( ( item, index ) => { if( searchData[ item ] !== "" && searchData !== null) { flag = false; if( keys.length - 1 !== index ) { url = url + item + '=' + searchData[ item ] + '&'; } else { url = url + item + '=' + searchData[ item ]; } } } ); if(flag){ url+="pageSize=-1" } else{ url+="&pageSize=-1" } console.log(url) window.open( url ); }