Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion libraries/mobile-ui/src/router-view/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<VanRouterViewOptions, 'keepAliveInclude'>({
title: '缓存页面',
description: '缓存页面,设置后只有匹配路径的页面会被缓存',
setter: {
concept: 'InputSetter',
},
if: (_) => !_.disableKeepAlive,
bindOpen: true,
})
keepAliveInclude: nasl.collection.List<nasl.core.String>;

@Prop<VanRouterViewOptions, 'keepAliveExclude'>({
title: '不缓存页面',
description: '不缓存页面,设置后只有匹配路径的页面不会被缓存',
setter: {
concept: 'InputSetter',
},
if: (_) => !_.disableKeepAlive,
bindOpen: true,
})
keepAliveExclude: nasl.collection.List<nasl.core.String>;

@Prop<VanRouterViewOptions, 'keepAliveMax'>({
title: '缓存页面最大数量',
description: '最多可以缓存多少组件实例(默认 不设上限)',
setter: {
concept: 'NumberInputSetter',
},
if: (_) => !_.disableKeepAlive,
})
keepAliveMax: nasl.core.Integer;
}
}
9 changes: 8 additions & 1 deletion libraries/mobile-ui/src/router-view/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
</div>
</div>
</div>
<router-view v-else></router-view>
<router-view v-else-if="disableKeepAlive"></router-view>
<keep-alive v-else :include="keepAliveInclude" :exclude="keepAliveExclude" :max="keepAliveMax">
<router-view></router-view>
</keep-alive>
</template>

<script>
Expand All @@ -31,6 +34,10 @@ export default {
},
props: {
designer: { type: Boolean, default: true },
disableKeepAlive: { type: Boolean, default: true },
keepAliveInclude: { type: [Array, String, RegExp] },
keepAliveExclude: { type: [Array, String, RegExp] },
keepAliveMax: { type: Number },
},
};
</script>
Expand Down
Loading