url链接后面拼接对象参数
1,现在需要把一个对象拼接到url链接后面2,方法html<a-button type="primary" icon="upload" @click="uploadExcel()">导出</a-button>jsuploadExcel() {let path = process.env.VUE_APP_API_BASE_URL +'/admin/xxxxxxxxxx/exp
·
1,现在需要把一个对象拼接到url链接后面
2,方法
html
<a-button type="primary" icon="upload" @click="uploadExcel()">导出</a-button>
js
uploadExcel() {
let path = process.env.VUE_APP_API_BASE_URL +'/admin/xxxxxxxxxx/export'
let obj = JSON.parse(JSON.stringify(this.queryParam)) //需要传(拼接)的参数对象
var i,
url = ''
for (i in obj) url += '&' + i + '=' + obj[i]
window.location.href = path + url.replace(/./, '?')
console.log(path + url.replace(/./, '?'))//返回拼接好的链接
},
更多推荐
已为社区贡献19条内容
所有评论(0)