//vue后端往前端传map写法,前端往后端传参数集合,queryInfo表示一个集合。
async getUserList() {
      const { data: res } = await this.$http.get("selectNetwork", {
        params: this.queryInfo,
      });
      this.userlist = res.data; // 将返回数据赋值
      console.log(this.userlist);
      this.total = res.number; // 总个数
    },
    //vue前端往后端传参数,如登录接口
    this.$http.post('login',{username:this.ruleForm.name,password:this.ruleForm.pass},{
                        // 上面相当于localhost:8080/login?username=name&password=pass
                            emulateJSON:true
                        }).then(Response =>{
                        if(Response.data == "ok"){
                            cookie.set('user',this.ruleForm.name);
                            window.sessionStorage.setItem('username',this.ruleForm.name);
                            this.$router.push({path:"/home"});
                        }else{
                            console.log(Response.data);
                            this.$message.error('用户名或密码错误');
                            return false;
                        }       
                    })  
//vue接收后端list,向后端传单个参数写法
showEditDialog(distributionNumber) {
      this.$http
        .get(
          "deliveryPartInfoByDistributionNumber",
          {
            params: {
              distributionNumber: distributionNumber,
            },
          },
          {
            emulateJSON: true,
          }
        )
        .then((Response) => {
          console.log(Response.data);
          this.userlist1 = Response.data;
        });
      this.dialogFormVisible = true;
    },                    
                    
    
Logo

前往低代码交流专区

更多推荐