vue - resource

github地址:https://github.com/pagekit/vue-resource/blob/develop/docs/http.md

 

常用请求:

1. get请求: 格式 url?request=text

this.$http.get(url + text).then((response) => {
response = response.body;
});

2. get请求: 格式 url?request={"start_page":xxx,"page_size":xxx}

this.$http({
method: 'get',
url: globals.URL,
params: {request: {start_page: 1,page_size:10}},
emulateJSON: true
}).then((response) => {
    response = respons.body;
});

3. post请求: 

this.$http.post(url ,{name:'admin',password:'123'}).then((response) => {
response = response.body;
});
posted @ 2017-07-21 16:50  千&叶  阅读(156)  评论(0编辑  收藏  举报