1、ES6語法不支持
解決方法:
引入babel-polyfill
npm install --save bable-polyfill
webpack.base.conf.js中修改爲
app: ['event-source-polyfill', 'babel-polyfill', './src/main.js']
main.js 中引入
import 'babel-polyfill';
2、GET非首次請求時,IE默認使用緩存而不是去後臺請求
解決方法:
在request攔截時,加時間戳
service.interceptors.request.use(config => { // Do something before request is sent // // 時間戳 if (config.method === 'get') { config.params = { t: Date.parse(new Date()) / 1000, ...config.params } } return config; }, error => { // Do something with request error console.log(error); // for debug Promise.reject(error); })
3、上傳文件時,文件類型檢查。如果爲.apk文件,則file.type爲" ".而jpg/png等文件正常
導致上傳apk文件時,會報類型檢查錯誤
解決方法:
export function validateApk(file) { if (file.type === 'application/vnd.android.package-archive') { return true; } else { if (file.name.substring(file.name.lastIndexOf('.') + 1) === 'apk') { return true; } } return false; }
4、上傳文件時,後臺讀取file.getName或者file.getOriginalName爲全路徑名稱
解決方法:
後臺去處理,如果爲全路徑,則進行字符串截取