diff --git a/docs/reference/api/README.md b/docs/reference/api/README.md index 47c7b8ad..a33f6555 100644 --- a/docs/reference/api/README.md +++ b/docs/reference/api/README.md @@ -74,7 +74,6 @@ Fes.js 路由基于 [Vue Router 4.0](https://next.router.vuejs.org/introduction. 返回当前 `router` 实例。 ```js import { getRouter } from "@fesjs/fes"; - const router = getRouter(); router.push(); ``` diff --git a/docs/reference/plugin/dev/api.md b/docs/reference/plugin/dev/api.md index 70209931..9c70905b 100644 --- a/docs/reference/plugin/dev/api.md +++ b/docs/reference/plugin/dev/api.md @@ -301,7 +301,7 @@ import { access, useAccess } from '@fesjs/fes'; ```js api.addCoreExports(() => [ { - specifiers: ['getRoutes', 'getRouter', 'getHistory', 'destroyRouter'], + specifiers: ['getRoutes'], source: absCoreFilePath } ]); diff --git a/docs/reference/plugin/plugins/qiankun.md b/docs/reference/plugin/plugins/qiankun.md index 61706c49..06c98428 100644 --- a/docs/reference/plugin/plugins/qiankun.md +++ b/docs/reference/plugin/plugins/qiankun.md @@ -269,3 +269,24 @@ export default { - 主应用使用 props 的模式传递数据(参考主应用装载子应用配置一节) - 子应用在生命周期钩子中获取 props 消费数据(参考子应用运行时配置一节) + + +### MicroApp +| 属性 | 说明 | 类型 | 默认值 | +| ---- | ----------- | ------------- | ---------- | +| name | 子应用名称,传入`qiankun.main.apps`配置中的`name` | String | - | +| settings | 子应用配置信息 | Object | {} | +| props | 传入子应用的参数 | Object | {} | +| lifeCycles | 子应用生命周期钩子 | Object | {} | +| cacheName | 子应用缓存名称,配置后根据`name`+`cacheName`缓存子应用实例 | Object | - | + + +### MicroAppWithMemoHistory +| 属性 | 说明 | 类型 | 默认值 | +| ---- | ----------- | ------------- | ---------- | +| name | 子应用名称,传入`qiankun.main.apps`配置中的`name` | String | - | +| settings | 子应用配置信息 | Object | {} | +| props | 传入子应用的参数 | Object | {} | +| lifeCycles | 子应用生命周期钩子 | Object | {} | +| cacheName | 子应用缓存名称,配置后根据`name`+`cacheName`缓存子应用实例 | Object | - | +| url | 子应用的路由地址 | String | - | \ No newline at end of file diff --git a/packages/fes-plugin-layout/src/runtime/views/MultiTabProvider.vue b/packages/fes-plugin-layout/src/runtime/views/MultiTabProvider.vue index 128e4bd7..c3e027c6 100644 --- a/packages/fes-plugin-layout/src/runtime/views/MultiTabProvider.vue +++ b/packages/fes-plugin-layout/src/runtime/views/MultiTabProvider.vue @@ -31,8 +31,11 @@ - - + + @@ -68,11 +71,12 @@ export default { return { path: _route.path, route: _route, - name: _route.meta.name, + name: _route.meta.name ?? _route.name, title: computed(() => transTitle(title)), key: getKey() }; }; + const keepAlivePages = ref([]); const route = useRoute(); const router = useRouter(); @@ -122,6 +126,12 @@ export default { } list.splice(index, 1); pageList.value = list; + const _keepAlivePages = [...keepAlivePages.value]; + const keepIndex = _keepAlivePages.indexOf(selectedPage.name); + if (keepIndex !== -1) { + _keepAlivePages.splice(keepIndex, 1); + } + keepAlivePages.value = _keepAlivePages; }; const reloadPage = (path) => { const selectedPage = findPage(path || unref(route.path)); @@ -132,6 +142,7 @@ export default { const closeOtherPage = (path) => { const selectedPage = findPage(path || unref(route.path)); pageList.value = [selectedPage]; + keepAlivePages.value = [selectedPage.name]; }; const getPageKey = (_route) => { const selectedPage = findPage(_route.path); @@ -151,10 +162,10 @@ export default { default: } }; - const keepAlivePages = ref([]); - const getComponent = (Component, _route) => { - if (_route.meta['keep-alive']) { - const name = _route.meta?.name || _route.name; + + const getComponent = (Component, _route, isKeep = false) => { + if (isKeep || _route.meta['keep-alive']) { + const name = _route.meta?.name ?? _route.name; if (name) { // 修改组件的 name Component.type.name = name; diff --git a/packages/fes-plugin-qiankun/examples/app1/src/pages/app1/index.vue b/packages/fes-plugin-qiankun/examples/app1/src/pages/app1/index.vue index ef9b2005..5dbfb5b9 100644 --- a/packages/fes-plugin-qiankun/examples/app1/src/pages/app1/index.vue +++ b/packages/fes-plugin-qiankun/examples/app1/src/pages/app1/index.vue @@ -1,6 +1,7 @@ diff --git a/packages/fes-plugin-qiankun/examples/app1/src/pages/app1/test.vue b/packages/fes-plugin-qiankun/examples/app1/src/pages/app1/test.vue index f20e10fd..746abb88 100644 --- a/packages/fes-plugin-qiankun/examples/app1/src/pages/app1/test.vue +++ b/packages/fes-plugin-qiankun/examples/app1/src/pages/app1/test.vue @@ -1,6 +1,7 @@ diff --git a/packages/fes-plugin-qiankun/examples/main/src/pages/index.vue b/packages/fes-plugin-qiankun/examples/main/src/pages/index.vue index 7e91d6fb..39dde730 100644 --- a/packages/fes-plugin-qiankun/examples/main/src/pages/index.vue +++ b/packages/fes-plugin-qiankun/examples/main/src/pages/index.vue @@ -1,9 +1,10 @@