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

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è)
欧美日韩免费高清视视频| 国内揄拍国内精品少妇国| 亚洲欧美日韩精品二区| 欧美日韩一级一区二区三区| 日本熟女肥臀一区二区| 18禁在线免费观看网站| 国产精品推荐不卡一区| 日本熟妇色在线视频不卡| 国产传媒在线视频观看| 亚洲精品色播一区二区| 久久国内午夜福利直播| 日本加勒比系列在线视频| 亚洲成人av在线直播| 国产原创剧情免费观看av| 日本高清免费中文字幕| 日韩欧美国产综合第一页| 精品少妇熟女av免费久久| 国产高清白丝免费在线观看| 四虎永久精品国产毛片| 91国内外精品自在线播放| 日韩久久这里只有精品视频| 在线观看中文字幕日韩精品| 精品国产一区二区三区性色av| 亚洲国产欧美日韩综合| 亚洲综合av一区二区三区四区| 国产91精品激烈高潮白浆| 国内久久婷婷综合五月趴| 欧美日韩一区二区综合性色| 国产成人精品一区二区国产乱码| 日韩精品成人区中文字幕| 女人天堂网av免费看| 午夜福利网午夜福利网| 婷婷色中文字幕综合在线| 日韩中文字幕在线二区| 九九国产精品免费视频| 五月天色婷婷亚洲综合一区| 国产叼嘿一区二区视频| 青青草免费在线视频视频| 亚洲福利一区二区在线| 国产在线播放精品视频| 加勒比人妻一区二区三区|