From 8d581295d4334ab5e6616c540c24e99a9d3585a2 Mon Sep 17 00:00:00 2001 From: wanchun <445436867@qq.com> Date: Mon, 16 May 2022 19:42:40 +0800 Subject: [PATCH 01/17] =?UTF-8?q?docs:=20=E6=B7=BB=E5=8A=A03.0=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/.vuepress/configs/navbar/zh.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/.vuepress/configs/navbar/zh.ts b/docs/.vuepress/configs/navbar/zh.ts index 4708e3e7..fb855120 100644 --- a/docs/.vuepress/configs/navbar/zh.ts +++ b/docs/.vuepress/configs/navbar/zh.ts @@ -21,6 +21,20 @@ export const zh: NavbarConfig = [ text: 'CLI', link: '/reference/cli/', }, + { + text: '版本', + children: [ + { + text: '3.0', + link: + 'http://fesjs.mumblefe.cn/next', + }, + { + text: '1.0', + link: 'https://webank.gitee.io/fes.js/', + }, + ], + }, { text: '了解更多', children: [ @@ -29,10 +43,6 @@ export const zh: NavbarConfig = [ link: 'https://github.com/WeBankFinTech/fes.js/blob/master/CHANGELOG.md', }, - { - text: 'v1 文档', - link: 'https://webank.gitee.io/fes.js/', - }, { text: 'fes-design', link: From 9f159804ba7f8a33b88caf78470fb5822bbb19d7 Mon Sep 17 00:00:00 2001 From: wanchun <445436867@qq.com> Date: Mon, 16 May 2022 19:49:28 +0800 Subject: [PATCH 02/17] =?UTF-8?q?docs:=20=E5=A4=84=E7=90=86=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E6=9E=84=E5=BB=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/reference/plugin/plugins/access.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/reference/plugin/plugins/access.md b/docs/reference/plugin/plugins/access.md index c5707055..c7450f49 100644 --- a/docs/reference/plugin/plugins/access.md +++ b/docs/reference/plugin/plugins/access.md @@ -163,7 +163,7 @@ import { access } from '@fesjs/fes' ``` #### access.hasAccess -- **类型**:( accessId: string | number ) => Promise<boolean> +- **类型**:( accessId: string | number ) => Promise\<boolean\> - **详情**: 判断某个资源是否可见。 - **参数**: From bfac2f0aaa51113930e2113f9e6eabb6569f05ad Mon Sep 17 00:00:00 2001 From: harrywan <445436867@qq.com> Date: Wed, 25 May 2022 11:02:55 +0800 Subject: [PATCH 03/17] =?UTF-8?q?docs:=20=E6=B7=BB=E5=8A=A01.0=20=E5=9C=B0?= =?UTF-8?q?=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/.vuepress/configs/navbar/zh.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/.vuepress/configs/navbar/zh.ts b/docs/.vuepress/configs/navbar/zh.ts index fb855120..a83602e1 100644 --- a/docs/.vuepress/configs/navbar/zh.ts +++ b/docs/.vuepress/configs/navbar/zh.ts @@ -25,13 +25,13 @@ export const zh: NavbarConfig = [ text: '版本', children: [ { - text: '3.0', + text: 'next(3.0)', link: - 'http://fesjs.mumblefe.cn/next', + 'https://fesjs.mumblefe.cn/next', }, { text: '1.0', - link: 'https://webank.gitee.io/fes.js/', + link: 'https://fesjs.mumblefe.cn/1.0', }, ], }, From eb31346b4c908ba225d39d275b49a2790fa53f47 Mon Sep 17 00:00:00 2001 From: harrywan <445436867@qq.com> Date: Wed, 25 May 2022 11:08:55 +0800 Subject: [PATCH 04/17] =?UTF-8?q?docs:=20pages=E5=8F=91=E5=B8=83master?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docs.yml | 12 ++++++++++++ docs/README.md | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 7b111d26..17716aa7 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -29,3 +29,15 @@ jobs: REMOTE_USER: root # 目标目录 TARGET: /data/web-packages/p/fesjs + build-and-deploy-pages: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@master + - name: Build and Deploy + uses: JamesIves/github-pages-deploy-action@master + env: + ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + BRANCH: gh-pages + FOLDER: docs/.vuepress/dist + BUILD_SCRIPT: yarn && yarn docs:build diff --git a/docs/README.md b/docs/README.md index 7158f58a..fe029997 100644 --- a/docs/README.md +++ b/docs/README.md @@ -13,7 +13,7 @@ features: - title: Fast details: Fes.js 内置路由、构建、插件管理,提供测试、布局、权限、国际化、状态管理、请求、数据字典、Svg等插件,可以满足大部分日常开发需求。 - title: Easy - details: 基于Vue.js 3.0,上手简单。贯彻 “约定优于配置” 思想,在设计插件上尽可能用约定替代配置,依然提供统一的插件配置入口,简单简洁又不失灵活。提供一致性的API入口,一致化的体验,学习起来更轻松。 + details: 基于Vue.js 3.0,上手非常简单。贯彻 “约定优于配置” 思想,在设计插件上尽可能用约定替代配置,依然提供统一的插件配置入口,简单简洁又不失灵活。提供一致性的API入口,一致化的体验,学习起来更轻松。 - title: Strong details: 仅仅需要关心页面内容,减少犯错的机会!提供单元测试、覆盖测试的能力保障项目质量。 - title: 可扩展 From 27016dadcf6047c3b203eb3f478e8d053a70ea94 Mon Sep 17 00:00:00 2001 From: harrywan <445436867@qq.com> Date: Wed, 25 May 2022 11:14:06 +0800 Subject: [PATCH 05/17] =?UTF-8?q?docs:=20=E4=BF=AE=E5=A4=8Ddocs=20action?= =?UTF-8?q?=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docs.yml | 26 +++++++++++++++++--------- docs/README.md | 2 +- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 17716aa7..8d9a25c6 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -29,15 +29,23 @@ jobs: REMOTE_USER: root # 目标目录 TARGET: /data/web-packages/p/fesjs + build-and-deploy-pages: + concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession. runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@master - - name: Build and Deploy - uses: JamesIves/github-pages-deploy-action@master - env: - ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} - BRANCH: gh-pages - FOLDER: docs/.vuepress/dist - BUILD_SCRIPT: yarn && yarn docs:build + - name: Checkout 🛎️ + uses: actions/checkout@v3 + + - name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built. + run: | + yarn + yarn docs:build + + - name: Deploy 🚀 + uses: JamesIves/github-pages-deploy-action@v4.3.3 + with: + branch: gh-pages # The branch the action should deploy to. + folder: build # The folder the action should deploy. + folder: docs/.vuepress/dist + token: ${{ secrets.ACCESS_TOKEN }} diff --git a/docs/README.md b/docs/README.md index fe029997..7158f58a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -13,7 +13,7 @@ features: - title: Fast details: Fes.js 内置路由、构建、插件管理,提供测试、布局、权限、国际化、状态管理、请求、数据字典、Svg等插件,可以满足大部分日常开发需求。 - title: Easy - details: 基于Vue.js 3.0,上手非常简单。贯彻 “约定优于配置” 思想,在设计插件上尽可能用约定替代配置,依然提供统一的插件配置入口,简单简洁又不失灵活。提供一致性的API入口,一致化的体验,学习起来更轻松。 + details: 基于Vue.js 3.0,上手简单。贯彻 “约定优于配置” 思想,在设计插件上尽可能用约定替代配置,依然提供统一的插件配置入口,简单简洁又不失灵活。提供一致性的API入口,一致化的体验,学习起来更轻松。 - title: Strong details: 仅仅需要关心页面内容,减少犯错的机会!提供单元测试、覆盖测试的能力保障项目质量。 - title: 可扩展 From b8835aae8790b27731fe85b9aeb20a250eb590c1 Mon Sep 17 00:00:00 2001 From: harrywan <445436867@qq.com> Date: Wed, 25 May 2022 11:15:18 +0800 Subject: [PATCH 06/17] =?UTF-8?q?docs:=20=E4=BF=AE=E5=A4=8Ddocs=20action?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docs.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 8d9a25c6..a05bc36f 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -29,7 +29,7 @@ jobs: REMOTE_USER: root # 目标目录 TARGET: /data/web-packages/p/fesjs - + build-and-deploy-pages: concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession. runs-on: ubuntu-latest @@ -46,6 +46,5 @@ jobs: uses: JamesIves/github-pages-deploy-action@v4.3.3 with: branch: gh-pages # The branch the action should deploy to. - folder: build # The folder the action should deploy. folder: docs/.vuepress/dist token: ${{ secrets.ACCESS_TOKEN }} From b9bedb96c024854fb537f1b19a9e0468efe40be1 Mon Sep 17 00:00:00 2001 From: harrywan <445436867@qq.com> Date: Wed, 25 May 2022 11:16:44 +0800 Subject: [PATCH 07/17] =?UTF-8?q?docs:=20=E8=A7=A6=E5=8F=91=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 7158f58a..fe029997 100644 --- a/docs/README.md +++ b/docs/README.md @@ -13,7 +13,7 @@ features: - title: Fast details: Fes.js 内置路由、构建、插件管理,提供测试、布局、权限、国际化、状态管理、请求、数据字典、Svg等插件,可以满足大部分日常开发需求。 - title: Easy - details: 基于Vue.js 3.0,上手简单。贯彻 “约定优于配置” 思想,在设计插件上尽可能用约定替代配置,依然提供统一的插件配置入口,简单简洁又不失灵活。提供一致性的API入口,一致化的体验,学习起来更轻松。 + details: 基于Vue.js 3.0,上手非常简单。贯彻 “约定优于配置” 思想,在设计插件上尽可能用约定替代配置,依然提供统一的插件配置入口,简单简洁又不失灵活。提供一致性的API入口,一致化的体验,学习起来更轻松。 - title: Strong details: 仅仅需要关心页面内容,减少犯错的机会!提供单元测试、覆盖测试的能力保障项目质量。 - title: 可扩展 From 4b1f9626fa25a044ab4d946600fa91b4234510da Mon Sep 17 00:00:00 2001 From: wanchun <445436867@qq.com> Date: Wed, 25 May 2022 11:34:10 +0800 Subject: [PATCH 08/17] =?UTF-8?q?docs:=20=E5=8F=91=E5=B8=83=E5=88=B0pages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docs.yml | 2 +- docs/.vuepress/config.ts | 2 +- package.json | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a05bc36f..88cb7b9a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -40,7 +40,7 @@ jobs: - name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built. run: | yarn - yarn docs:build + yarn docs:build-pages - name: Deploy 🚀 uses: JamesIves/github-pages-deploy-action@v4.3.3 diff --git a/docs/.vuepress/config.ts b/docs/.vuepress/config.ts index 7fe65c08..67ab9867 100644 --- a/docs/.vuepress/config.ts +++ b/docs/.vuepress/config.ts @@ -6,7 +6,7 @@ const config: UserConfig<DefaultThemeOptions> = { bundler: '@vuepress/webpack', - base: '/', + base: process.env.BASE ? process.env.BASE : '/', // evergreen: process.env.NODE_ENV !== 'production', diff --git a/package.json b/package.json index f33e79e0..bbcdc15a 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "release": "node scripts/build.js && lerna publish from-git", "docs:dev": "vuepress dev docs --clean-cache", "docs:build": "vuepress build docs --clean-cache", + "docs:build-pages": "BASE=fes.js vuepress build docs --clean-cache", "test": "fes test", "lint": "eslint -c ./.eslintrc.js --ext .js,.jsx,.vue,.ts" }, From 63792444bb72326212965c7d2a4933f4a5eb277e Mon Sep 17 00:00:00 2001 From: wanchun <445436867@qq.com> Date: Wed, 25 May 2022 11:44:10 +0800 Subject: [PATCH 09/17] =?UTF-8?q?docs:=20=E4=BF=AE=E5=A4=8D=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E6=96=87=E6=A1=A3action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bbcdc15a..68fceb8d 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "release": "node scripts/build.js && lerna publish from-git", "docs:dev": "vuepress dev docs --clean-cache", "docs:build": "vuepress build docs --clean-cache", - "docs:build-pages": "BASE=fes.js vuepress build docs --clean-cache", + "docs:build-pages": "BASE=fes.js/ vuepress build docs --clean-cache", "test": "fes test", "lint": "eslint -c ./.eslintrc.js --ext .js,.jsx,.vue,.ts" }, From 7b5f1e3264da96cc43fe72366cceaad570440fca Mon Sep 17 00:00:00 2001 From: wanchun <445436867@qq.com> Date: Wed, 25 May 2022 11:49:22 +0800 Subject: [PATCH 10/17] =?UTF-8?q?docs:=20=E4=BF=AE=E5=A4=8D=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E6=96=87=E6=A1=A3action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 68fceb8d..7b7c9562 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "release": "node scripts/build.js && lerna publish from-git", "docs:dev": "vuepress dev docs --clean-cache", "docs:build": "vuepress build docs --clean-cache", - "docs:build-pages": "BASE=fes.js/ vuepress build docs --clean-cache", + "docs:build-pages": "BASE=/fes.js/ vuepress build docs --clean-cache", "test": "fes test", "lint": "eslint -c ./.eslintrc.js --ext .js,.jsx,.vue,.ts" }, From 400d254a4b9969fc76127b587e6267e08702cf5f Mon Sep 17 00:00:00 2001 From: wanchun <445436867@qq.com> Date: Mon, 30 May 2022 16:48:13 +0800 Subject: [PATCH 11/17] =?UTF-8?q?feat:=20plugin-layout=20=E5=A4=9A?= =?UTF-8?q?=E9=A1=B5=E7=AD=BE=E5=8F=AF=E4=BB=A5=E5=88=A0=E9=99=A4=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/runtime/views/MultiTabProvider.vue | 21 +++++--- packages/fes-template/.fes.js | 2 +- yarn.lock | 54 ++++++++++++++++++- 3 files changed, 69 insertions(+), 8 deletions(-) diff --git a/packages/fes-plugin-layout/src/runtime/views/MultiTabProvider.vue b/packages/fes-plugin-layout/src/runtime/views/MultiTabProvider.vue index 2dff56e8..128e4bd7 100644 --- a/packages/fes-plugin-layout/src/runtime/views/MultiTabProvider.vue +++ b/packages/fes-plugin-layout/src/runtime/views/MultiTabProvider.vue @@ -13,7 +13,7 @@ v-for="page in pageList" :key="page.path" :value="page.path" - :closable="route.path !== page.path" + :closable="pageList.length > 1" > <template #tab> {{page.title}} @@ -80,11 +80,11 @@ export default { const actions = [ { value: 'closeOtherPage', - label: '关闭其他' + label: '关闭其他页签' }, { value: 'reloadPage', - label: '刷新当前页' + label: '刷新当前页签' } ]; @@ -97,20 +97,29 @@ export default { return true; }); // 还需要考虑参数 - const switchPage = (path) => { + const switchPage = async (path) => { const selectedPage = findPage(path); if (selectedPage) { - router.push({ + await router.push({ path, query: selectedPage.route.query, params: selectedPage.route.params }); } }; - const handleCloseTab = (targetKey) => { + const handleCloseTab = async (targetKey) => { const selectedPage = findPage(targetKey); const list = [...pageList.value]; const index = list.indexOf(selectedPage); + if (route.path === selectedPage.path) { + if (list.length > 1) { + if (list.length - 1 === index) { + await switchPage(list[index - 1].path); + } else { + await switchPage(list[index + 1].path); + } + } + } list.splice(index, 1); pageList.value = list; }; diff --git a/packages/fes-template/.fes.js b/packages/fes-template/.fes.js index 0ac088fa..2d2b290b 100644 --- a/packages/fes-template/.fes.js +++ b/packages/fes-template/.fes.js @@ -36,7 +36,7 @@ export default { layout: { title: 'Fes.js', footer: 'Created by MumbleFE', - multiTabs: false, + multiTabs: true, navigation: 'side', theme: 'dark', menus: [ diff --git a/yarn.lock b/yarn.lock index 865cd27b..be234b40 100644 --- a/yarn.lock +++ b/yarn.lock @@ -205,6 +205,15 @@ "@jridgewell/gen-mapping" "^0.1.0" jsesc "^2.5.1" +"@babel/generator@^7.18.2": + version "7.18.2" + resolved "https://registry.npmmirror.com/@babel/generator/-/generator-7.18.2.tgz#33873d6f89b21efe2da63fe554460f3df1c5880d" + integrity sha512-W1lG5vUwFvfMd8HVXqdfbuG7RuaSrTCCD8cl8fP8wOivdbtbIg2Db3IWUcgvfxKbbn6ZBGYRW/Zk1MIwK49mgw== + dependencies: + "@babel/types" "^7.18.2" + "@jridgewell/gen-mapping" "^0.3.0" + jsesc "^2.5.1" + "@babel/helper-annotate-as-pure@^7.16.7": version "7.16.7" resolved "https://registry.npmmirror.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.16.7.tgz#bb2339a7534a9c128e3102024c60760a3a7f3862" @@ -272,6 +281,11 @@ dependencies: "@babel/types" "^7.16.7" +"@babel/helper-environment-visitor@^7.18.2": + version "7.18.2" + resolved "https://registry.npmmirror.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.2.tgz#8a6d2dedb53f6bf248e31b4baf38739ee4a637bd" + integrity sha512-14GQKWkX9oJzPiQQ7/J36FTXcD4kSp8egKjO9nINlSKiHITRA9q/R74qu8S9xlc/b/yjsJItQUeeh3xnGN0voQ== + "@babel/helper-explode-assignable-expression@^7.16.7": version "7.16.7" resolved "https://registry.npmmirror.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.16.7.tgz#12a6d8522fdd834f194e868af6354e8650242b7a" @@ -418,6 +432,11 @@ resolved "https://registry.npmmirror.com/@babel/parser/-/parser-7.17.10.tgz#873b16db82a8909e0fbd7f115772f4b739f6ce78" integrity sha512-n2Q6i+fnJqzOaq2VkdXxy2TCPCWQZHiCo0XqmrCvDWcZQKRyZzYi4Z0yxlBuN0w+r2ZHmre+Q087DSrw3pbJDQ== +"@babel/parser@^7.18.0": + version "7.18.4" + resolved "https://registry.npmmirror.com/@babel/parser/-/parser-7.18.4.tgz#6774231779dd700e0af29f6ad8d479582d7ce5ef" + integrity sha512-FDge0dFazETFcxGw/EXzOkN8uJp0PC7Qbm+Pe9T+av2zlBpOgunFHkQPPn+eRuClU73JF+98D531UgayY89tow== + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.16.7": version "7.16.7" resolved "https://registry.npmmirror.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.16.7.tgz#4eda6d6c2a0aa79c70fa7b6da67763dfe2141050" @@ -1146,7 +1165,7 @@ "@babel/parser" "^7.16.7" "@babel/types" "^7.16.7" -"@babel/traverse@^7.0.0", "@babel/traverse@^7.13.0", "@babel/traverse@^7.15.0", "@babel/traverse@^7.16.7", "@babel/traverse@^7.16.8", "@babel/traverse@^7.17.10", "@babel/traverse@^7.17.3", "@babel/traverse@^7.17.9", "@babel/traverse@^7.7.2": +"@babel/traverse@^7.0.0", "@babel/traverse@^7.13.0", "@babel/traverse@^7.15.0", "@babel/traverse@^7.16.7", "@babel/traverse@^7.16.8", "@babel/traverse@^7.17.3", "@babel/traverse@^7.17.9", "@babel/traverse@^7.7.2": version "7.17.9" resolved "https://registry.npmmirror.com/@babel/traverse/-/traverse-7.17.9.tgz#1f9b207435d9ae4a8ed6998b2b82300d83c37a0d" integrity sha512-PQO8sDIJ8SIwipTPiR71kJQCKQYB5NGImbOviK8K+kg5xkNSYXLBupuX9QhatFowrsvo9Hj8WgArg3W7ijNAQw== @@ -1162,6 +1181,22 @@ debug "^4.1.0" globals "^11.1.0" +"@babel/traverse@^7.17.10": + version "7.18.2" + resolved "https://registry.npmmirror.com/@babel/traverse/-/traverse-7.18.2.tgz#b77a52604b5cc836a9e1e08dca01cba67a12d2e8" + integrity sha512-9eNwoeovJ6KH9zcCNnENY7DMFwTU9JdGCFtqNLfUAqtUHRCOsTOqWoffosP8vKmNYeSBUv3yVJXjfd8ucwOjUA== + dependencies: + "@babel/code-frame" "^7.16.7" + "@babel/generator" "^7.18.2" + "@babel/helper-environment-visitor" "^7.18.2" + "@babel/helper-function-name" "^7.17.9" + "@babel/helper-hoist-variables" "^7.16.7" + "@babel/helper-split-export-declaration" "^7.16.7" + "@babel/parser" "^7.18.0" + "@babel/types" "^7.18.2" + debug "^4.1.0" + globals "^11.1.0" + "@babel/types@^7.0.0", "@babel/types@^7.16.0", "@babel/types@^7.16.7", "@babel/types@^7.16.8", "@babel/types@^7.17.0", "@babel/types@^7.17.10", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": version "7.17.10" resolved "https://registry.npmmirror.com/@babel/types/-/types-7.17.10.tgz#d35d7b4467e439fcf06d195f8100e0fea7fc82c4" @@ -1170,6 +1205,14 @@ "@babel/helper-validator-identifier" "^7.16.7" to-fast-properties "^2.0.0" +"@babel/types@^7.18.2": + version "7.18.4" + resolved "https://registry.npmmirror.com/@babel/types/-/types-7.18.4.tgz#27eae9b9fd18e9dccc3f9d6ad051336f307be354" + integrity sha512-ThN1mBcMq5pG/Vm2IcBmPPfyPXbd8S02rS+OBIDENdufvqC7Z/jHPCv9IcP01277aKtDI8g/2XysBN4hA8niiw== + dependencies: + "@babel/helper-validator-identifier" "^7.16.7" + to-fast-properties "^2.0.0" + "@bcoe/v8-coverage@^0.2.3": version "0.2.3" resolved "https://registry.npmmirror.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" @@ -1725,6 +1768,15 @@ "@jridgewell/set-array" "^1.0.0" "@jridgewell/sourcemap-codec" "^1.4.10" +"@jridgewell/gen-mapping@^0.3.0": + version "0.3.1" + resolved "https://registry.npmmirror.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.1.tgz#cf92a983c83466b8c0ce9124fadeaf09f7c66ea9" + integrity sha512-GcHwniMlA2z+WFPWuY8lp3fsza0I8xPFMWL5+n8LYyP6PSvPrXf4+n8stDHZY2DM0zy9sVkRDy1jDI4XGzYVqg== + dependencies: + "@jridgewell/set-array" "^1.0.0" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.9" + "@jridgewell/resolve-uri@^3.0.3": version "3.0.7" resolved "https://registry.npmmirror.com/@jridgewell/resolve-uri/-/resolve-uri-3.0.7.tgz#30cd49820a962aff48c8fffc5cd760151fca61fe" From d37d6b480b27846530f640425e5d941686b9e83b Mon Sep 17 00:00:00 2001 From: wanchun <445436867@qq.com> Date: Mon, 30 May 2022 16:49:32 +0800 Subject: [PATCH 12/17] chore(release): publish - @fesjs/plugin-layout@4.2.0 --- packages/fes-plugin-layout/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fes-plugin-layout/package.json b/packages/fes-plugin-layout/package.json index f075fa2a..d899b633 100644 --- a/packages/fes-plugin-layout/package.json +++ b/packages/fes-plugin-layout/package.json @@ -1,6 +1,6 @@ { "name": "@fesjs/plugin-layout", - "version": "4.1.0", + "version": "4.2.0", "description": "@fesjs/plugin-layout", "main": "lib/index.js", "files": [ From c09dfeadde2c06b3f297057558297a340a4239bd Mon Sep 17 00:00:00 2001 From: harrywan <445436867@qq.com> Date: Tue, 7 Jun 2022 17:29:24 +0800 Subject: [PATCH 13/17] =?UTF-8?q?Fix=20qiankun=20=E5=86=85=E5=AD=98?= =?UTF-8?q?=E6=B3=84=E6=BC=8F=E9=97=AE=E9=A2=98=20(#126)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复乾坤插件内存问题 * fix: 多页签时关闭页面需要清除缓存 * feat: 乾坤增加entry配置,用于区别同一name不同位置用法 * docs: 去掉文档 * fix: preset-build-in的route api 兼容 * fix: 修复问题 * docs: 更新w文档 * fix: 变更api --- docs/reference/api/README.md | 1 - docs/reference/plugin/dev/api.md | 2 +- docs/reference/plugin/plugins/qiankun.md | 21 ++++++++++++++++ .../src/runtime/views/MultiTabProvider.vue | 25 +++++++++++++------ .../examples/app1/src/pages/app1/index.vue | 1 + .../examples/app1/src/pages/app1/test.vue | 1 + .../examples/main/src/pages/index.vue | 3 ++- .../src/main/modifyRoutes.js | 5 ++-- .../src/main/runtime/MicroApp.tpl | 23 +++++++++++------ .../main/runtime/MicroAppWithMemoHistory.tpl | 1 + .../runtime/getMicroAppRouteComponent.tpl | 3 ++- .../src/micro/runtime/lifecycles.tpl | 20 ++++++++++++--- .../src/micro/runtime/runtime.tpl | 17 ++++++------- .../src/plugins/generateFiles/fes/fes.tpl | 1 + .../plugins/misc/route/template/routes.tpl | 5 +--- 15 files changed, 91 insertions(+), 38 deletions(-) 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 @@ </template> </FTabs> <router-view v-slot="{ Component, route }"> - <keep-alive> - <component :is="Component" :key="getPageKey(route)" /> + <keep-alive :include="keepAlivePages"> + <component + :is="getComponent(Component, route, true)" + :key="getPageKey(route)" + /> </keep-alive> </router-view> </template> @@ -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 @@ <template> <div class="haizekuo"> app1 - index + <input /> </div> </template> <config> 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 @@ <template> <div class="haizekuo"> app1 - test + <input /> </div> </template> <config> 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 @@ <template> <div> main + <input /> <FTabs v-model="activeKey"> <FTabPane name="Tab 1" value="1"> - <MicroAppWithMemoHistory key="1" name="app1" url="/app1" a="1" /> + <MicroAppWithMemoHistory key="1" style="background: red" name="app1" url="/app1" a="1" /> </FTabPane> <FTabPane name="Tab 2" value="2"> <MicroAppWithMemoHistory key="2" name="app1" url="/app1/test" /> diff --git a/packages/fes-plugin-qiankun/src/main/modifyRoutes.js b/packages/fes-plugin-qiankun/src/main/modifyRoutes.js index 62f691d7..e785c3dd 100644 --- a/packages/fes-plugin-qiankun/src/main/modifyRoutes.js +++ b/packages/fes-plugin-qiankun/src/main/modifyRoutes.js @@ -2,11 +2,11 @@ import { defaultHistoryType } from '../constants'; function getMicroApp(options) { const { - key, microAppName, masterHistoryType, base, namespace, ...normalizedRouteProps + key, microAppName, cacheName, masterHistoryType, base, namespace, ...normalizedRouteProps } = options; return `(() => { const { getMicroAppRouteComponent } = require('@@/${namespace}/getMicroAppRouteComponent'); -return getMicroAppRouteComponent({key: '${key}', appName: '${microAppName}', base: '${base}', masterHistoryType: '${masterHistoryType}', routeProps: ${JSON.stringify(normalizedRouteProps)} }) +return getMicroAppRouteComponent({key: '${key}', appName: '${microAppName}', cacheName: '${cacheName}', base: '${base}', masterHistoryType: '${masterHistoryType}', routeProps: ${JSON.stringify(normalizedRouteProps)} }) })()`; } @@ -19,6 +19,7 @@ function modifyRoutesWithAttachMode({ if (route.meta && route.meta.microApp) { route.component = getMicroApp({ key: route.path, + cacheName: route.meta.cacheName ?? route.path, microAppName: route.meta.microApp, masterHistoryType, base, diff --git a/packages/fes-plugin-qiankun/src/main/runtime/MicroApp.tpl b/packages/fes-plugin-qiankun/src/main/runtime/MicroApp.tpl index 1140bdbe..30809037 100644 --- a/packages/fes-plugin-qiankun/src/main/runtime/MicroApp.tpl +++ b/packages/fes-plugin-qiankun/src/main/runtime/MicroApp.tpl @@ -12,13 +12,13 @@ import {mergeWith} from "{{{LODASH_ES}}}"; // eslint-disable-next-line import/extensions import { getMasterOptions } from "./masterOptions"; -function unmountMicroApp(microApp) { +async function unmountMicroApp(microApp) { if (!microApp) { return; } const status = microApp.getStatus(); if (status === 'MOUNTED') { - microApp.unmount(); + await microApp.unmount(); } } @@ -28,6 +28,7 @@ export const MicroApp = defineComponent({ type: String, required: true }, + cacheName: String, settings: Object, props: Object, lifeCycles: Object @@ -64,26 +65,26 @@ export const MicroApp = defineComponent({ return {}; }); + const propsConfigRef = computed(() => { return { ...propsFromConfigRef.value, ...props.props, - ...attrs }; }); // 只有当name变化时才重新加载新的子应用 const loadApp = () => { const appConfig = appConfigRef.value; - const { name, entry } = appConfig; + const { name, cacheName } = appConfig; // 加载新的 - microAppRef.value = loadMicroApp( + const app = loadMicroApp( { // 保证唯一 - name: `${name}_${Date.now()}`, + name: `${name}_${props.cacheName || ''}`, entry: entry, container: containerRef.value, - props: {...propsConfigRef.value} + props: {...propsConfigRef.value, ...attrs} }, { ...globalSettings, @@ -96,6 +97,12 @@ export const MicroApp = defineComponent({ (v1, v2) => concat(v1 ?? [], v2 ?? []) ) ); + ['loadPromise', 'bootstrapPromise', 'mountPromise', 'unmountPromise'].forEach((key)=>{ + app[key].catch((e)=>{ + console.warn("[@fesjs/plugin-qiankun]", e) + }) + }) + microAppRef.value = app; }; // 当参数变化时,update子应用 @@ -131,7 +138,7 @@ export const MicroApp = defineComponent({ } // 返回 microApp.update 形成链式调用 - return microApp.update({...propsConfigRef.value}); + return microApp.update({...propsConfigRef.value, ...attrs}); } } ); diff --git a/packages/fes-plugin-qiankun/src/main/runtime/MicroAppWithMemoHistory.tpl b/packages/fes-plugin-qiankun/src/main/runtime/MicroAppWithMemoHistory.tpl index f14e748a..e92bb7b7 100644 --- a/packages/fes-plugin-qiankun/src/main/runtime/MicroAppWithMemoHistory.tpl +++ b/packages/fes-plugin-qiankun/src/main/runtime/MicroAppWithMemoHistory.tpl @@ -14,6 +14,7 @@ export const MicroAppWithMemoHistory = defineComponent({ type: String, required: true }, + cacheName: String, settings: Object, props: Object, lifeCycles: Object, diff --git a/packages/fes-plugin-qiankun/src/main/runtime/getMicroAppRouteComponent.tpl b/packages/fes-plugin-qiankun/src/main/runtime/getMicroAppRouteComponent.tpl index 074ab2cf..c338fc60 100644 --- a/packages/fes-plugin-qiankun/src/main/runtime/getMicroAppRouteComponent.tpl +++ b/packages/fes-plugin-qiankun/src/main/runtime/getMicroAppRouteComponent.tpl @@ -3,10 +3,11 @@ import { MicroApp } from './MicroApp'; export function getMicroAppRouteComponent({ key, appName, + cacheName, base, masterHistoryType, routeProps }) { - return <MicroApp key={key} base={base} masterHistoryType={masterHistoryType} name={appName} {...routeProps} />; + return <MicroApp key={key} base={base} masterHistoryType={masterHistoryType} name={appName} cacheName={cacheName} {...routeProps} />; } diff --git a/packages/fes-plugin-qiankun/src/micro/runtime/lifecycles.tpl b/packages/fes-plugin-qiankun/src/micro/runtime/lifecycles.tpl index c98aed7a..48469482 100644 --- a/packages/fes-plugin-qiankun/src/micro/runtime/lifecycles.tpl +++ b/packages/fes-plugin-qiankun/src/micro/runtime/lifecycles.tpl @@ -1,4 +1,4 @@ -import { plugin, ApplyPluginsType, getRouter, getHistory, destroyRouter } from '@@/core/coreExports'; +import { plugin, ApplyPluginsType } from '@@/core/coreExports'; {{#HAS_PLUGIN_MODEL}} import { setModelState } from './qiankunModel'; {{/HAS_PLUGIN_MODEL}} @@ -18,6 +18,7 @@ function isPromise(obj) { let render = () => {}; let cacheAppPromise = null; let hasMountedAtLeastOnce = false; +const cache = {}; export default () => defer.promise; @@ -91,6 +92,11 @@ export function genMount(mountElementId) { defer.resolve(); } hasMountedAtLeastOnce = true; + cacheAppPromise.then((app)=>{ + if(!cache[props.name]) { + cache[props.name] = app; + } + }) }; } @@ -109,9 +115,15 @@ export function genUpdate() { // 子应用生命周期钩子Unmount export function genUnmount() { return async (props) => { - const history = getHistory(); - history.destroy(); // 会触发app.unmount - destroyRouter(); + if (cache[props.name]) { + setTimeout(() => { + const app = cache[props.name]; + app.unmount(); + app._container.innerHTML = ''; + delete cache[props.name]; + cacheAppPromise = null; + }, 0); + } const slaveRuntime = getSlaveRuntime(); if (slaveRuntime.unmount) { await slaveRuntime.unmount(props); diff --git a/packages/fes-plugin-qiankun/src/micro/runtime/runtime.tpl b/packages/fes-plugin-qiankun/src/micro/runtime/runtime.tpl index 63a0bcd1..2d620c2c 100644 --- a/packages/fes-plugin-qiankun/src/micro/runtime/runtime.tpl +++ b/packages/fes-plugin-qiankun/src/micro/runtime/runtime.tpl @@ -1,5 +1,5 @@ -import { createMemoryHistory, getHistory } from '@@/core/coreExports'; -import qiankunRender, { clientRenderOptsStack, history } from './lifecycles'; +import { createMemoryHistory } from '@@/core/coreExports'; +import qiankunRender, { clientRenderOptsStack, history as historyConfig } from './lifecycles'; export const render = oldRender => qiankunRender().then(oldRender); @@ -15,19 +15,18 @@ export function modifyClientRenderOpts(memo) { } export function modifyCreateHistory(memo) { - if (history.url) { + if (historyConfig.url) { return createMemoryHistory } return memo; } -export function onRouterCreated({ router }) { - if(history.url) { - const memoryHistory = getHistory(); - memoryHistory.push(history.url) +export function onRouterCreated({ router, history }) { + if(historyConfig.url) { + history.push(historyConfig.url) } - if(history.onRouterInit){ - history.onRouterInit(router) + if(historyConfig.onRouterInit){ + historyConfig.onRouterInit(router) } } diff --git a/packages/fes-preset-built-in/src/plugins/generateFiles/fes/fes.tpl b/packages/fes-preset-built-in/src/plugins/generateFiles/fes/fes.tpl index 295a50a9..b66d1b85 100644 --- a/packages/fes-preset-built-in/src/plugins/generateFiles/fes/fes.tpl +++ b/packages/fes-preset-built-in/src/plugins/generateFiles/fes/fes.tpl @@ -61,6 +61,7 @@ const beforeRender = async ({rootElement}) => { console.error(e); } app.unmount(); + app._container.innerHTML = ''; } return initialState; }; diff --git a/packages/fes-preset-built-in/src/plugins/misc/route/template/routes.tpl b/packages/fes-preset-built-in/src/plugins/misc/route/template/routes.tpl index 0a7e3cba..f130e641 100644 --- a/packages/fes-preset-built-in/src/plugins/misc/route/template/routes.tpl +++ b/packages/fes-preset-built-in/src/plugins/misc/route/template/routes.tpl @@ -10,9 +10,6 @@ const ROUTER_BASE = '{{{ routerBase }}}'; let router = null; let history = null; export const createRouter = (routes) => { - if (router) { - return router; - } const createHistory = plugin.applyPlugins({ key: 'modifyCreateHistory', type: ApplyPluginsType.modify, @@ -36,7 +33,7 @@ export const createRouter = (routes) => { plugin.applyPlugins({ key: 'onRouterCreated', type: ApplyPluginsType.event, - args: { router }, + args: { router, history }, }); return router; From 1bf20e110807da4222a9517dd33c959586f15449 Mon Sep 17 00:00:00 2001 From: wanchun <445436867@qq.com> Date: Tue, 7 Jun 2022 17:35:56 +0800 Subject: [PATCH 14/17] chore(release): publish - @fesjs/plugin-layout@4.2.1 - @fesjs/plugin-qiankun@2.1.0 - @fesjs/preset-built-in@2.1.1 - @fesjs/fes@2.1.1 --- packages/fes-plugin-layout/package.json | 2 +- packages/fes-plugin-qiankun/package.json | 2 +- packages/fes-preset-built-in/package.json | 2 +- packages/fes/package.json | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/fes-plugin-layout/package.json b/packages/fes-plugin-layout/package.json index d899b633..6f148f12 100644 --- a/packages/fes-plugin-layout/package.json +++ b/packages/fes-plugin-layout/package.json @@ -1,6 +1,6 @@ { "name": "@fesjs/plugin-layout", - "version": "4.2.0", + "version": "4.2.1", "description": "@fesjs/plugin-layout", "main": "lib/index.js", "files": [ diff --git a/packages/fes-plugin-qiankun/package.json b/packages/fes-plugin-qiankun/package.json index 773d10ea..4bccfaf2 100644 --- a/packages/fes-plugin-qiankun/package.json +++ b/packages/fes-plugin-qiankun/package.json @@ -1,6 +1,6 @@ { "name": "@fesjs/plugin-qiankun", - "version": "2.0.13", + "version": "2.1.0", "description": "@fesjs/plugin-qiankun", "main": "lib/index.js", "files": [ diff --git a/packages/fes-preset-built-in/package.json b/packages/fes-preset-built-in/package.json index de272357..96dfcf6b 100644 --- a/packages/fes-preset-built-in/package.json +++ b/packages/fes-preset-built-in/package.json @@ -1,6 +1,6 @@ { "name": "@fesjs/preset-built-in", - "version": "2.1.0", + "version": "2.1.1", "description": "@fesjs/preset-built-in", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/fes/package.json b/packages/fes/package.json index 732b5671..7149b866 100644 --- a/packages/fes/package.json +++ b/packages/fes/package.json @@ -1,6 +1,6 @@ { "name": "@fesjs/fes", - "version": "2.1.0", + "version": "2.1.1", "description": "一个好用的前端管理台快速开发框架", "preferGlobal": true, "scripts": { @@ -39,7 +39,7 @@ ], "dependencies": { "@fesjs/compiler": "^2.0.5", - "@fesjs/preset-built-in": "^2.1.0", + "@fesjs/preset-built-in": "^2.1.1", "@fesjs/runtime": "^2.0.2", "@fesjs/utils": "^2.0.4", "resolve-cwd": "^3.0.0" From 2a433855f0d311298461579da81af83ffbdef255 Mon Sep 17 00:00:00 2001 From: wanchun <445436867@qq.com> Date: Tue, 7 Jun 2022 20:07:26 +0800 Subject: [PATCH 15/17] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=B9=BE?= =?UTF-8?q?=E5=9D=A4=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fes-plugin-qiankun/src/main/runtime/MicroApp.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fes-plugin-qiankun/src/main/runtime/MicroApp.tpl b/packages/fes-plugin-qiankun/src/main/runtime/MicroApp.tpl index 30809037..4e524891 100644 --- a/packages/fes-plugin-qiankun/src/main/runtime/MicroApp.tpl +++ b/packages/fes-plugin-qiankun/src/main/runtime/MicroApp.tpl @@ -76,7 +76,7 @@ export const MicroApp = defineComponent({ // 只有当name变化时才重新加载新的子应用 const loadApp = () => { const appConfig = appConfigRef.value; - const { name, cacheName } = appConfig; + const { name, entry } = appConfig; // 加载新的 const app = loadMicroApp( { From 5bacf31098a51eeb949d75399108da31c8753503 Mon Sep 17 00:00:00 2001 From: wanchun <445436867@qq.com> Date: Wed, 8 Jun 2022 19:27:59 +0800 Subject: [PATCH 16/17] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dqiankun=E5=86=85?= =?UTF-8?q?=E5=AD=98=E6=B3=84=E9=9C=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../examples/app1/src/pages/app1/index.vue | 1 + .../examples/app1/src/pages/app1/test.vue | 1 + .../main/runtime/MicroAppWithMemoHistory.tpl | 24 ++++++++++++------- .../src/micro/runtime/lifecycles.tpl | 9 ++++++- 4 files changed, 26 insertions(+), 9 deletions(-) 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 5dbfb5b9..caddbdd3 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 @@ -14,6 +14,7 @@ export default { setup() { return { + leak: new Array(5 * 1024 * 1024) }; } }; 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 746abb88..bff5e603 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 @@ -14,6 +14,7 @@ export default { setup() { return { + leak: new Array(5 * 1024 * 1024) }; } }; diff --git a/packages/fes-plugin-qiankun/src/main/runtime/MicroAppWithMemoHistory.tpl b/packages/fes-plugin-qiankun/src/main/runtime/MicroAppWithMemoHistory.tpl index e92bb7b7..7ab8f9ed 100644 --- a/packages/fes-plugin-qiankun/src/main/runtime/MicroAppWithMemoHistory.tpl +++ b/packages/fes-plugin-qiankun/src/main/runtime/MicroAppWithMemoHistory.tpl @@ -1,10 +1,6 @@ - -import { - defineComponent, isRef, watch -} from 'vue'; +import { defineComponent, watch, onUnmounted } from 'vue'; import { MicroApp } from './MicroApp'; - export const MicroAppWithMemoHistory = defineComponent({ components: { MicroApp @@ -26,9 +22,21 @@ export const MicroAppWithMemoHistory = defineComponent({ microRouter = router; microRouter.push(props.url); }; - watch(()=>props.url, () => { - microRouter.push(props.url); + watch( + () => props.url, + () => { + microRouter.push(props.url); + } + ); + onUnmounted(() => { + microRouter = null; }); - return () => <MicroApp onRouterInit={onRouterInit} {...props} {...attrs}></MicroApp>; + return () => ( + <MicroApp + onRouterInit={onRouterInit} + {...props} + {...attrs} + ></MicroApp> + ); } }); diff --git a/packages/fes-plugin-qiankun/src/micro/runtime/lifecycles.tpl b/packages/fes-plugin-qiankun/src/micro/runtime/lifecycles.tpl index 48469482..a12e9b52 100644 --- a/packages/fes-plugin-qiankun/src/micro/runtime/lifecycles.tpl +++ b/packages/fes-plugin-qiankun/src/micro/runtime/lifecycles.tpl @@ -1,4 +1,4 @@ -import { plugin, ApplyPluginsType } from '@@/core/coreExports'; +import { plugin, ApplyPluginsType, getHistory, destroyRouter } from '@@/core/coreExports'; {{#HAS_PLUGIN_MODEL}} import { setModelState } from './qiankunModel'; {{/HAS_PLUGIN_MODEL}} @@ -49,6 +49,7 @@ export function genBootstrap(oldRender, appPromise) { if (isPromise(appPromise)) { cacheAppPromise = appPromise; } + appPromise = null; }; } @@ -115,6 +116,12 @@ export function genUpdate() { // 子应用生命周期钩子Unmount export function genUnmount() { return async (props) => { + Object.keys(history).forEach(key=>{ + delete history[key] + }) + const routerHistory = getHistory(); + routerHistory?.destroy(); + destroyRouter(); if (cache[props.name]) { setTimeout(() => { const app = cache[props.name]; From bd3542a184786ceb8473490a338352a44fb832a0 Mon Sep 17 00:00:00 2001 From: wanchun <445436867@qq.com> Date: Wed, 8 Jun 2022 19:28:33 +0800 Subject: [PATCH 17/17] chore(release): publish - @fesjs/plugin-qiankun@2.1.1 --- packages/fes-plugin-qiankun/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fes-plugin-qiankun/package.json b/packages/fes-plugin-qiankun/package.json index 4bccfaf2..6659b032 100644 --- a/packages/fes-plugin-qiankun/package.json +++ b/packages/fes-plugin-qiankun/package.json @@ -1,6 +1,6 @@ { "name": "@fesjs/plugin-qiankun", - "version": "2.1.0", + "version": "2.1.1", "description": "@fesjs/plugin-qiankun", "main": "lib/index.js", "files": [