vue 请求方式

参数以对象的方式传给后台

this.axios({
    url:'api/login',
    method:'post',
    params:{
        password:this.ruleForm.passwords,
        username:this.ruleForm.name
    }
    }).then(response => {

    }).catch((error) => {

});

参数以拼接的方式传给后台

this.axios.post('api/sys/sms/checkmobile?mobile=' + this.regulation
    .then(response => {

    }).catch((error) => {

});

参数请求需要请求头

this.axios({
    method: 'get',
    url: 'api/sys/role/list,
    headers: {'token': this.access_token},
    }).then(response => {
        console.log(response)
    }).catch((error) => {

})

 

posted @ 2017-12-11 16:19  learnoff  阅读(350)  评论(0编辑  收藏  举报