Selaa lähdekoodia

@zengqiao@修改主应用代码

HexOr 3 vuotta sitten
vanhempi
commit
ddf336c503

+ 3 - 0
share/2021-11-microfront/parent-vue/src/App.vue

@ -35,7 +35,9 @@
35 35
36 36
      <!--主体-->
37 37
      <el-main>
38
        <!--基座自身页面的路由容器-->
38 39
        <router-view v-if="isBase" />
40
        <!--微前端的容器-->
39 41
        <div  v-else id="sub-container"></div>
40 42
      </el-main>
41 43
    </el-container>
@ -51,6 +53,7 @@
51 53
      }
52 54
    },
53 55
    computed: {
56
      // 判段路由是否是自身页面还是微前端的页面
54 57
      isBase() {
55 58
        const path = this.$route.path
56 59
        const reg = RegExp('^/vue(2|3)')

share/2021-11-microfront/parent-vue/src/assets/reset.less → share/2021-11-microfront/parent-vue/src/assets/index.less


+ 5 - 5
share/2021-11-microfront/parent-vue/src/main.js

@ -4,7 +4,7 @@ import router from './router'
4 4
import store from './store'
5 5
import ElementUI from 'element-ui';
6 6
import 'element-ui/lib/theme-chalk/index.css'
7
import './assets/reset.less'
7
import './assets/index.less'
8 8
import {registerMicroApps, start, runAfterFirstMounted, setDefaultMountApp, initGlobalState} from 'qiankun'
9 9
10 10
Vue.config.productionTip = false
@ -24,10 +24,10 @@ new Vue({
24 24
 */
25 25
const appOptions = [
26 26
  {
27
    name: 'child-vue2',
28
    entry: '//localhost:7102',
29
    container: '#sub-container',
30
    activeRule: '/vue2'
27
    name: 'child-vue2', // 注册应用名
28
    entry: '//localhost:7102', // 注册服务
29
    container: '#sub-container', // 挂载的容器
30
    activeRule: '/vue2' // 路由匹配规则
31 31
  },
32 32
  {
33 33
    name: 'child-vue3',