vue-resource 设置请求的参数以formData形式以及设置请求的过滤器

在main.js中添加下面的设置:

Vue.http.options.emulateJSON = true;
Vue.http.options.headers = {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'};

Vue.http.interceptors.push((request, next) => {
next((response) => {}

});

 

注意:一定要加在的Vue实例之前

posted on 2017-07-19 09:39  半夏微澜ぺ  阅读(1023)  评论(0编辑  收藏  举报