代码拉取完成,页面将自动刷新
//api/index.js
//引入 axios 二次封装的 get、post 方法
import {get,post} from './common/http';
//封装项目中 ajax 请求
export const getList=get('http://www.xxx.com/api');
// views/Home.vue
// 项目中使用
import {getList} from '@api/index'
export default {
mounted(){
getList({
'uid':'0001',
})
}
}
//api/common/url.js
//支持多域名
module.exports={
// key(自定义关键字): value(代理域名)
// key 值用于开发环境中 proxy 代理拦截
// value 值用于生产环境中使用
'API':'https://www.xxx.com',
'MZL':'https://www.uuu.com',
}
//api/index.js
// 引入二次封装的 axios 方法;
import {get,post} from './common/http';
// 引入 auto.url.js 模块,获取动态生成的API接口url地址
import URL from './common/auto.url';
const {API,MZL}=URL;
// get 请求中使用
export const getList=get(API+'/api');
git cz
git push
npm run release
git push --tags
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。