2025-01-20 08:09:54 +00:00
|
|
|
<template>
|
2025-01-22 10:47:57 +08:00
|
|
|
<!-- <el-button v-for="item in microApps" :key="item.activeRule" type="primary" @click="gotoPage(item)">{{ item.name }}</el-button> -->
|
|
|
|
<router-view />
|
2025-01-20 08:09:54 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup name="App">
|
|
|
|
import { reactive, provide, nextTick } from 'vue';
|
|
|
|
import { microApps } from '@/micro/app';
|
|
|
|
import actions from '@/micro/actions';
|
|
|
|
|
|
|
|
const state = reactive({
|
|
|
|
isRouterAlive: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
const gotoPage = (row) => {
|
|
|
|
const data = {};
|
|
|
|
switch (row.name) {
|
|
|
|
case 'sub-vue':
|
|
|
|
data.title = 'sub-vue';
|
|
|
|
break;
|
|
|
|
case 'sub-admin':
|
|
|
|
data.title = 'sub-admin';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// 设置与子应用通信的值
|
|
|
|
actions.setGlobalState({
|
|
|
|
data: data,
|
|
|
|
});
|
|
|
|
window.history.pushState({}, row.name, row.activeRule);
|
|
|
|
};
|
|
|
|
|
|
|
|
const reload = () => {
|
|
|
|
state.isRouterAlive = false;
|
|
|
|
nextTick(() => {
|
|
|
|
state.isRouterAlive = true;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
provide('reload', reload);
|
|
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
|
|
@import './styles/style.scss';
|
|
|
|
</style>
|