Просмотр исходного кода

@zengqiao@修改主应用代码

HexOr лет назад: 3
Родитель
Сommit
ddf336c503

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

35
35
36
      <!--主体-->
36
      <!--主体-->
37
      <el-main>
37
      <el-main>
38
        <!--基座自身页面的路由容器-->
38
        <router-view v-if="isBase" />
39
        <router-view v-if="isBase" />
40
        <!--微前端的容器-->
39
        <div  v-else id="sub-container"></div>
41
        <div  v-else id="sub-container"></div>
40
      </el-main>
42
      </el-main>
41
    </el-container>
43
    </el-container>
51
      }
53
      }
52
    },
54
    },
53
    computed: {
55
    computed: {
56
      // 判段路由是否是自身页面还是微前端的页面
54
      isBase() {
57
      isBase() {
55
        const path = this.$route.path
58
        const path = this.$route.path
56
        const reg = RegExp('^/vue(2|3)')
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
import store from './store'
4
import store from './store'
5
import ElementUI from 'element-ui';
5
import ElementUI from 'element-ui';
6
import 'element-ui/lib/theme-chalk/index.css'
6
import 'element-ui/lib/theme-chalk/index.css'
7
import './assets/reset.less'
7
import './assets/index.less'
8
import {registerMicroApps, start, runAfterFirstMounted, setDefaultMountApp, initGlobalState} from 'qiankun'
8
import {registerMicroApps, start, runAfterFirstMounted, setDefaultMountApp, initGlobalState} from 'qiankun'
9
9
10
Vue.config.productionTip = false
10
Vue.config.productionTip = false
24
 */
24
 */
25
const appOptions = [
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
    name: 'child-vue3',
33
    name: 'child-vue3',