标签:class fun err imp vue install type dev error
npm install axios --save-dev
import axios from ‘axios‘
Vue.prototype.$http = axios
this.$http.get(‘https://erienniu.xyz/api/sidebar‘)
.then(function(response) {
console.log(response.data)
})
.catch(function(error) {
console.log(error)
})
https://github.com/axios/axios/blob/master/COOKBOOK.md#jsonp
$ npm install jsonp --save
const jsonp = require(‘jsonp‘);
jsonp(‘http://www.example.com/foo‘, null, (err, data) => {
if (err) {
console.error(err.message);
} else {
console.log(data);
}
});
标签:class fun err imp vue install type dev error
原文地址:https://www.cnblogs.com/wulzt/p/9531836.html