javascript - How to pass parameters to the get method in vue-resource without using splicing.
学习ing
学习ing 2017-06-15 09:23:35
0
1
902

When I used the get method before, I always subconsciously spliced ​​the parameters on the link. Recently I heard that when using the get method of vue-resource, I can directly pass the parameters like a post. I couldn't find the document address and wanted to take a leave directly. Now, how should this parameter be passed?

The following method I used does not work~
let arg = {search: 'haha'}
this.$http.get(link, arg, {

...

}

学习ing
学习ing

reply all(1)
女神的闺蜜爱上我
     getInfo(){
        const params = {partnerId: partnerId, openId: openId}
        this.$http.get(commonUrl + "/restful/member2?op=get", {params:params}).then(response => {
            console.log(response)
          if (response.data.errcode === 0) {
            this.dataInfo = response.data
          } else {
//            this.$router.push({path: '/Register'})
          }
          Indicator.close()
        }, response => {
        });
      },

Like this. . . For reference only

Now vue is more recommended to use axios

axios.get('/user', {
    params: {
      ID: 12345
    }
  })
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });

This should be what you want~

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template