demo-qiankun-child-app
介绍
demo-qiankun-child-app前端服务
软件架构
基于vue前端框架,element-ui前端组件库搭建的微前端服务项目。此项目为整个前端微服务中的子应用。1、用于满足系统业务功能。2、被父应用调用
git 代码仓库获取
- 克隆仓库,切换到对应分支
git clone http://xxxxxxxx.git
git checkout branch_name
- 初始化子仓库
git submodule init
git submodule update
安装教程
- 环境要求:nodejs 16.0版本以上
- 在当前目录运行安转命令
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install
使用说明
- 开发环境命令
npm run serve
- uat环境,项目构建命令
npm run build-uat
- 生产环境,项目构建命令
npm run build-pro
#### 部署目录
1. 构建后生成dist目录,服务器根目录,或nginx指向目录 /dist
2. 因前端路由采取是history模式,所以nginx要配置try_files $uri $uri/ /index.html,如:
location / { root /usr/share/nginx/html; index index.html index.htm; try_files $uri $uri/ /index.html; }
3. 此应用为子应用被主应用调用时,要允许跨域,如nginx配置:
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';