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

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è)
日本高清视频免费一区| 国产91精品在线观看| 国产有码视频一区二区三区| 国产在线一区二区三区观看| 亚洲国产成在人网站天堂| 亚洲日本国产精品一区| 人妻精品中文字幕一区二区在线| 亚洲国产专区一区二区麻豆| 成人av资源在线观看| 91九色国产老熟女乱子| 国产一区二区三区区别| 国产免费不卡午夜福利在线| 国产精品深夜在线观看| 亚洲人成免费观看网站| 91精品手机在线观看| 中文字幕一区二区精品人妻| 欧美日韩一区二区高清在线| 亚洲国产中日韩精品综合| 18禁在线免费观看网站| 六月综合激情丁香婷婷色| 亚洲va在线va天堂va在线| 成人午夜激情福利动态| 97高清视频在线观看| 日韩中文字幕在线二区| 中文字幕乱码熟女人妻视频 | 欧美国内日本一区二区| 久久中文字幕日韩精品| 国产在线视频不卡一线路| 国产精品久久乱码综合| 国产三级精品av在线| 人妻久久一区二区三区精品99| 侵犯人妻中文字幕一区二区| 国语av一区二区三区| 综合激情四射亚洲激情| 欧美午夜激情片在线观看| 亚州国产成人综合精品| 日韩色欧美色国产精品| 午夜福利视频在线观看| 亚洲熟妇人妻一区二区三区| 欧美成人免费做真爱高潮| 久久东京热日韩精品一区|