vue学习

需要nodejs和npm的支持

npm配置文件需要注意下载文件的位置

注意事项:npm install 需要进入到项目中运行

                  vue init webpack [项目名]需要到项目外层文件夹执行

https://www.runoob.com/vue2/vue-start.html

vue打造多页面应用

https://www.cnblogs.com/xiyangcai/p/8609773.html

vue+axios实现跨域访问外部接口

1.npm install axios --save

2.import axios from 'axios'

   Vue.prototype.$axios = axios;

3.在config/index.js中,配置代理

proxyTable: {
'/': {
target: 'http://ewealth.abchina.com', // 你请求的第三方接口
secure : false,
changeOrigin: true, // 在本地会创建一个虚拟服务端,然后发送请求的数据,并同时接收请求的数据,这样服务端和服务端进行数据的交互就不会有跨域问题
pathRewrite: { // 路径重写,
'^/api': '/' // 替换target中的请求地址,也就是说以后你在请求http://api.jisuapi.com/XXXXX这个地址的时候直接写成/api即可。
},
headers : {
referrer : 'http://ewealth.abchina.com'
}
}
},


4.this.$axios.get('/api/app/data/api/DataService/RealTimeExchangeRateV2').then(res => {
console.log(res)
}).catch(err => {
console.log(err.response)
})

原文地址:https://www.cnblogs.com/wangc04/p/10785171.html