天天看點

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執行個體之前

轉載于:https://www.cnblogs.com/xiaofenguo/p/7204053.html

繼續閱讀