Commit d26b95fe authored by lipengcheng 's avatar lipengcheng

feat: 重新提交

parent cc196048
...@@ -14,7 +14,9 @@ export default { ...@@ -14,7 +14,9 @@ export default {
return this.$route.meta.layout || 'default-layout' return this.$route.meta.layout || 'default-layout'
} }
}, },
async created() {}, async created() {
this.request()
},
methods: { methods: {
async request() { async request() {
let result = await this.$http.get('/webapi/home/banner?type=1&category=18') let result = await this.$http.get('/webapi/home/banner?type=1&category=18')
......
...@@ -4,7 +4,7 @@ import router from './router' ...@@ -4,7 +4,7 @@ import router from './router'
import store from './store' import store from './store'
import './registerServiceWorker' import './registerServiceWorker'
import './assets/style/index.scss' import './assets/style/index.scss'
import axios from 'axios' import axios from '@/plugins/axios.js'
import VueBus from 'vue-bus' import VueBus from 'vue-bus'
import VModal from 'vue-js-modal' import VModal from 'vue-js-modal'
import moment from '@/plugins/moment.js' import moment from '@/plugins/moment.js'
...@@ -13,11 +13,12 @@ import globalComponents from '@/components/global/index.js' ...@@ -13,11 +13,12 @@ import globalComponents from '@/components/global/index.js'
import filters from '@/filters/index.js' import filters from '@/filters/index.js'
import directives from '@/directives/index.js' import directives from '@/directives/index.js'
import utils from '@/utils/index.js' import utils from '@/utils/index.js'
console.log('axios:', axios)
// 全局注册layout组件 // 全局注册layout组件
Vue.use(layoutComponents) Vue.use(layoutComponents)
// 注册自定义全局组件 // 注册自定义全局组件
Object.keys(globalComponents).forEach((compName) => Vue.component(compName, globalComponents[compName])) Object.keys(globalComponents).forEach((compName) => Vue.component(compName, globalComponents[compName]))
// 注册全局自定义filter // 注 册全局自定义filter
Object.keys(filters).forEach((key) => Vue.filter(key, filters[key])) Object.keys(filters).forEach((key) => Vue.filter(key, filters[key]))
// 注册全局自定义directive // 注册全局自定义directive
Object.keys(directives).forEach((key) => Vue.directive(key, directives[key])) Object.keys(directives).forEach((key) => Vue.directive(key, directives[key]))
......
import axios from 'axios'
console.log('axios:', axios)
/**
* 默认配置
*/
axios.defaults.baseURL = ''
axios.defaults.headers.common['a-laihua-defined-key'] = 'a customized value'
// 请求拦截
axios.interceptors.request.use(
(config) => {
// 在发送请求之前做些什么
// config.headers.common['cookie-id'] = cookieId
return config
},
(err) => {
// 对请求错误做些什么
Promise.reject(err)
}
)
// 响应拦截
axios.interceptors.response.use(
(response) => {
// 对响应数据做点什么
return response
},
function(error) {
// 对响应错误做点什么
return Promise.reject(error)
}
)
export default axios
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment