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

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://www.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| 久久亚洲中文字幕精品熟女| 视频一区二区中文字幕日韩| 日本h电影一区二区三区| 色爱区偷拍人妻中文字幕| 在线日韩中文字幕二区| 午夜在线观看成人av| 日本 午夜 在线 视频| 国产一区二区伦理视频| 精品国产乱码久久蜜桃| 国产三级全黄在线播放| 久久99久久久国产精品| 91桃色午夜福利视频| 欧美伊人久久综合成人网| 久久精品国产av一一区| 亚洲精品国产熟女高潮 | 欧美精品激情在线不卡| 亚洲国产精品一区二区三区在线 | 青青青久热国产精品视频| 九九热久久这里全是精品| 欧美日韩国产精品久久乐播| 亚洲人妻一区二区久久| 国产精品黄色av一区二区| 韩国午夜福利视频网站| 性生活的视频免费观看麻豆| 亚洲精品福利一二三区| 亚洲黄色av乱码在线观看| 麻豆精品情欲人妻一区| 午夜夫妻生活视频在线观看| 日韩精品一区二区在线天天狠天 | 亚洲熟女少妇淫语高潮| 亚洲男人堂色偷偷一区| 欧美日韩国产另类在线视频| 亚洲国产中文一区二区久久| 又爽又色的日本网站| 白色发布会在线观看免费| 中文字幕国产精品一区二| 亚洲免费三级黄色片|