日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學(xué)無先后,達(dá)者為師

網(wǎng)站首頁 Vue 正文

vue element ui el-select多選與后端傳值(多選,換成字符串?dāng)?shù)組的形式傳值)

作者:傻的太壞 更新時(shí)間: 2024-03-04 Vue

未處理時(shí),表單傳值如下:
timeRange[0]: 2022-10-14
timeRange[1]: 2022-11-14
customerRegionint[0]: 山西省
customerRegionint[1]: 長治市
industry[0]: 1,1-1
industry[1]: 1,1-2
industry[2]: 2,2-1
industry[3]: 2,2-2
industry[4]: 2,2-3
industry[5]: 2,2-4

只需要加這句處理一下: this.queryParams.timeRange = this.queryParams.timeRange.join(",")
    /** 查詢客戶列表 */
     getList() {
      this.loading = true;
      // 復(fù)制對象
      var queryParams = JSON.parse(JSON.stringify(this.queryParams));

      //時(shí)間換成字符串?dāng)?shù)組
      if (this.queryParams.timeRange) {
        queryParams.timeRange = this.queryParams.timeRange.join(",");
      }

      // 行業(yè)換成字符串?dāng)?shù)組
      if (this.queryParams.industry) {
        queryParams.industry = this.queryParams.industry.join(",");
      }
      // 地區(qū)換成字符串?dāng)?shù)組
      if (this.queryParams.customerRegionint) {
        queryParams.customerRegionint =
          this.queryParams.customerRegionint.join(",");
      }

      console.log(queryParams);
      listCustomer(queryParams).then((response) => {
        this.customerList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },

表單傳值的結(jié)果如下:
timeRange: 2022-10-07,2022-11-15
customerRegionint: 內(nèi)蒙古自治區(qū),赤峰市
industry: 1,1-1,1,1-2,2,2-1,2,2-2,2,2-3,2,2-4

原文鏈接:https://blog.csdn.net/weixin_38897313/article/details/127257833

  • 上一篇:沒有了
  • 下一篇:沒有了
欄目分類
最近更新