admin管理员组

文章数量:819727

vue 中通过 ajax 生成form 下载表格

recordsClick(){ //导出表格 var params = {// 参数 smartWatermeterId: this. $route. query. watermeterId, startTime: this. formVal. startTime, endTime: this. formVal. endTime, };
var form = document. createElement( 'form'); form. id = 'form' form. name = 'form' document. body. appendChild( form); for( var obj in params) { if( params. hasOwnProperty( obj)) { var input = document. createElement( 'input'); input. tpye= 'hidden'; input. name = obj; input. value = params[ obj]; form. appendChild( input) } } form. method = "GET";//请求方式 form. action = runEnv. api_url+ '请求地址'; form. submit(); document. body. removeChild( form); },

本文标签: vue 中通过 ajax 生成form 下载表格