Coder Social home page Coder Social logo

yihuan / qiankun-base Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 339 KB

Main app of micro frontend architecture with qiankun, with everything configured to be ready to use

JavaScript 18.90% HTML 0.38% Vue 76.34% SCSS 4.28% CSS 0.11%
eslint pinia prettier vue vuecli vuerouter

qiankun-base's Introduction

qiankun基座项目

qiankun基座项目,通过 qiankun 加载其他子项目

项目启动

本地开发

  • 包管理工具:yarn(建议,远程打包机器也是用的yarn)
  • Node 版本:14.19.2
  • 本地安装:yarn or yarn install
  • 本地删除重新安装:yarn reinstall
  • 本地启动:yarn start
  • 编译打包:yarn build
  • Lint:yarn lint

子应用配置

菜单或页面中需要加载子应用页面的配置

  • app.const.jsSUB_APPS 中配置子应用详细信息

    // key: 唯一值,区分子应用,路由配置需要
    // domain: 子应用域名
    // shortPath: 短路径名称
    export const SUB_APPS = freeze({
      WORK: freeze({
        key: 'work',
        domain: isProd
          ? `${origin}/work/`                // 远程环境配置
          : 'http://localdomain.com:8001/work/', // 本地配置
        shortPath: 'w'
      })
    }
  • 在路由 router/index.js 中配置路由

    // router/index.js
    {
      name: 'HomeWork',
      path: SUB_APPS.WORK.shortPath,
      component: () => import('@/views/HomeWork.vue')
    }

    在需要插入子应用页面的地方引入 SubAppEntry

    // HomeWork.vue
    <template>
      <SubAppEntry />
    </template>
    <script setup>
    import SubAppEntry from '@/components/common/SubAppEntry.vue'
    </script>

    路由页面中指定位置引入子应用可参考这里

后端接口域名配置

api.js 中的 BASE_URL 定义。

export const BASE_URL = isProd
  ? window.location.origin + '/work/'                   // 线上
  : window.location.protocol + '//localdomain.com/work/' // 本地

开发规范及示例文档

qiankun-base's People

Contributors

yihuan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.