From bd99d376faf110b7741b94c8e1d8903011a8a4cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=A1=E9=A3=8E?= <18012261618@126.com> Date: Thu, 25 Jun 2026 10:33:29 +0800 Subject: [PATCH] =?UTF-8?q?feat(mobile-ui):=20router-view=E6=94=AF?= =?UTF-8?q?=E6=8C=81keep-alive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libraries/mobile-ui/src/router-view/api.ts | 43 ++++++++++++++++++- libraries/mobile-ui/src/router-view/index.vue | 9 +++- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/libraries/mobile-ui/src/router-view/api.ts b/libraries/mobile-ui/src/router-view/api.ts index 9b09681d7..f0f7d43f7 100644 --- a/libraries/mobile-ui/src/router-view/api.ts +++ b/libraries/mobile-ui/src/router-view/api.ts @@ -12,5 +12,46 @@ namespace nasl.ui { super(); } } - export class VanRouterViewOptions extends ViewComponentOptions {} + export class VanRouterViewOptions extends ViewComponentOptions { + @Prop({ + title: '进入已打开页面时刷新', + description: '重新进入已打开页面时,会刷新页面', + setter: { + concept: 'SwitchSetter', + }, + }) + disableKeepAlive: nasl.core.Boolean = true; + + @Prop({ + title: '缓存页面', + description: '缓存页面,设置后只有匹配路径的页面会被缓存', + setter: { + concept: 'InputSetter', + }, + if: (_) => !_.disableKeepAlive, + bindOpen: true, + }) + keepAliveInclude: nasl.collection.List; + + @Prop({ + title: '不缓存页面', + description: '不缓存页面,设置后只有匹配路径的页面不会被缓存', + setter: { + concept: 'InputSetter', + }, + if: (_) => !_.disableKeepAlive, + bindOpen: true, + }) + keepAliveExclude: nasl.collection.List; + + @Prop({ + title: '缓存页面最大数量', + description: '最多可以缓存多少组件实例(默认 不设上限)', + setter: { + concept: 'NumberInputSetter', + }, + if: (_) => !_.disableKeepAlive, + }) + keepAliveMax: nasl.core.Integer; + } } diff --git a/libraries/mobile-ui/src/router-view/index.vue b/libraries/mobile-ui/src/router-view/index.vue index b268ec13c..f3e8d8e75 100644 --- a/libraries/mobile-ui/src/router-view/index.vue +++ b/libraries/mobile-ui/src/router-view/index.vue @@ -17,7 +17,10 @@ - + + + +