写一个隐藏的Form表单:
<form id="hiddenForm" :action="exportDataAction" hidden="true" method="POST" > <input :value="dataForm.poNbr" name="poNbr" > <input :value="dataForm.orderDate" name="orderDate" > <input v-if="dataForm.tempDate" :value="dataForm.tempDate[0]" name="startOrderDate" > <input v-if="dataForm.tempDate" :value="dataForm.tempDate[1]" name="endOrderDate" > <input :value="dataForm.status" name="status" > <input :value="dataForm.tp" name="tp" > <input :value="userId" name="buyerId" > <input :value="userRole" name="userRole" > </form> data(){ exportDataAction: "/nodPunish/exportData", } //导出 downloadData() { this.exportFlag = true; let hiddenForm = document.getElementById("hiddenForm"); if (this.dataForm.tempDate) { this.dataForm.startOrderDate = this.dataForm.tempDate[0]; this.dataForm.endOrderDate = this.dataForm.tempDate[1]; } else { this.dataForm.startOrderDate = null; this.dataForm.endOrderDate = null; } hiddenForm.submit(); this.exportFlag = false;