欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

Vue怎么整合axios

這篇文章主要介紹“Vue怎么整合axios”的相關(guān)知識(shí),小編通過實(shí)際案例向大家展示操作過程,操作方法簡(jiǎn)單快捷,實(shí)用性強(qiáng),希望這篇“Vue怎么整合axios”文章能幫助大家解決問題。

創(chuàng)新互聯(lián)堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:網(wǎng)站建設(shè)、網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的湖北網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

整合文件axios.js

import axios from 'axios';

// 適配vue-resource

const instance = axios.create();
instance.interceptors.request.use(config=> {
//Serialize.decode(config);
return config;
});
instance.interceptors.response.use(response=> {
return response.data;
}, err=> {
if (err.response) {
axios.post('/v1/error', err.response);
return Promise.reject(err.response.data);
}
return Promise.reject({ code: 1024, message: err.message });
});


functionplugin(Vue){
if (plugin.installed) {
return;
}
Vue.http = instance;
}

if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(plugin);
}

export default plugin;

vue插件使用 app.js

import Vue from 'vue';
import App from './App.vue';
import store from './store';
import { sync } from 'vuex-router-sync';
import router from './router';
import * as filters from './filters';
import yxui from 'yxui/dist/yxui.min';
import axios from './axios';


Vue.use(yxui);
Vue.use(axios);

// sync the router with the vuex store.
// this registers `store.state.route`
sync(store, router);

// register global utility filters.
Object.keys(filters).forEach(key=> {
Vue.filter(key, filters[key]);
});

// create the app instance.
// here we inject the router and store to all child components,
// making them available everywhere as `this.$router` and `this.$store`.

const app = new Vue({
router,
store,
...App
});

// expose the app, the router and the store.
// note we not mounting the app here, since bootstrapping will be
// different depending on whether we are in browser or on the server.
export { app, router, store };

在vuex action 中使用:

actions: {
// adList
[TypesAds.AD_GET_LIST](ctx, params){
return Vue.http.get('/v1/api/ads/list', {params}).then(data=> {
ctx.commit(TypesAds.AD_GET_LIST, data);
return data;
}).catch(err=> {
//統(tǒng)一錯(cuò)誤處理
Vue.$message.error(err.msg);
});
}
}

關(guān)于“Vue怎么整合axios”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí),可以關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,小編每天都會(huì)為大家更新不同的知識(shí)點(diǎn)。

網(wǎng)站題目:Vue怎么整合axios
標(biāo)題來源:http://aaarwkj.com/article22/gopecc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站策劃、手機(jī)網(wǎng)站建設(shè)、自適應(yīng)網(wǎng)站、網(wǎng)站收錄營銷型網(wǎng)站建設(shè)、品牌網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)
亚洲男人天堂黄色av| 99精品国产中文字幕| 蜜臀av中文字幕亚洲| 中文字幕亚洲精品熟女少妇| 成人午夜福利影院在线| 久久99久久久国产精品| 日本av二区三区在线| 亚洲欧美日韩性生活视频| 国产91香蕉在线精品| 野花日本免费高清完整| 中文字幕国产精品一区二| 久草福利资源在线观看视频 | 麻豆黄片在线免费观看| 国产精品美女丝袜久久久| 国产精品青青在线观看爽香蕉| 国产口爆一区二区三区| 精品嫩模福利一区二区蜜臀| 久久99热这里只频精品| 精品国产综合一区二区三区| 综合av在线一区天堂| 国产精品久久中文字幕网| 国产三级精品电影久久| 日本一级特黄大片做受在线观看| 日本福利资源在线观看| 欧美一级特黄大片免色| 91日本视频在线播放| 热99精品视频在线观看| 伊人狼人综合视频在线播放| 日本一区二区三区高清在线| 五月天丁香婷婷深爱| 中文字幕伦理一区二区三区| 成年人免费观看黄色片| 欧美午夜福利视频电影| 亚洲国产精品一区二区av不卡| 欧美日韩人美精品一区在线| 亚洲熟妇亚洲熟妇亚洲熟妇| 国产成人综合亚洲欧美在线| 欧美黄片在线免费观看视频 | 中文字幕一区二区三区不卡日日| 国产精品一区二区精品| 91欧美日韩在线观看视频|