123456789101112131415161718192021222324252627282930313233343536 |
- export default {
- install (Vue) {
-
-
- Vue.prototype.$axios.defaults.baseURL = 'http://42.193.189.15:300'
-
- Vue.prototype.$axios.defaults.timeout = 10000
-
- Vue.prototype.request = function (url, method, data, success, header) {
- this.$axios({
- url: url,
- method: method,
- headers: header || {
- 'Accept': 'application/json'
- },
- data: method === 'post' ? JSON.stringify(data) : {},
- params: method === 'get' ? data : {}
- })
- .then(res => {
- if (success) {
- success(res.data)
- }
- })
- .catch(res => {
- console.log(res)
- })
- }
- }
- }
|