首页 新闻 赞助 找找看

使用window.open()get请求,怎么传token

0
悬赏园豆:40 [待解决问题]

downloadTemplate(){
store.get('token')
window.open(defaultUrl + "User/DownloadTemplateFile");
},
拿到token不知道怎么传

for()的主页 for() | 初学一级 | 园豆:123
提问于:2021-08-04 10:49
< >
分享
所有回答(2)
0

方法有几个
1 url 中传
2 cookie传

2012 | 园豆:21228 (高人七级) | 2021-08-04 14:50
0

downloadTemplate(){
// window.open(defaultUrl + "User/DownloadTemplateFile");
DownloadTemplateFileRequest({
url: "User/DownloadTemplateFile",
method: "get",
}).then((res) => {
let url = window.URL.createObjectURL(new Blob([res]))
let link = document.createElement('a')
link.style.display = 'none'
link.href = url
link.setAttribute('download', 'UserTemplate' + '.xls')
document.body.appendChild(link);
link.click();
});
},

for() | 园豆:123 (初学一级) | 2021-08-04 15:41

你这个很明显是同一个域名呀, 自己存 本地,不可以吗?

支持(0) 反对(0) 永远跟党走i | 园豆:1517 (小虾三级) | 2021-08-05 14:57
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册