vue window.location.href post
时间: 2023-09-01 21:09:47 浏览: 250
解决vue.js this.$router.push无效的问题
5星 · 资源好评率100%
回答: 如果你在Vue中想要使用window.location.href进行页面跳转,并且使用POST方法传递数据,你可以通过以下方式实现。首先,在你的Vue文件中引入一个名为"exportWather"的方法,这个方法用来发送导出请求并返回导出的数据。然后,在点击下载按钮时,调用这个方法,并将返回的数据创建为一个Blob对象,设置下载链接的属性,并将链接添加到页面中,最后触发点击事件来进行下载。具体代码如下:
```javascript
import { exportWather } from "./exportData"
export default {
methods: {
exportProficients() {
let that = this;
let params = {
startTime: this.time [3<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [window.location.href()采用post传递数据](https://blog.csdn.net/a5534789/article/details/38532053)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [如何在window.location.href加请求头(token)示例导出文件](https://blog.csdn.net/sun_pingpuan/article/details/125392972)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [vue前端调后台接口下载文件(get,post方法集合)](https://blog.csdn.net/qq_38801090/article/details/121806911)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文