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(/./, '?'))//返回拼接好的链接 
    },

 

Logo

前往低代码交流专区

更多推荐