dd-uni-simple-router
Version:
> 一个更为简洁的[Vue-router](https://router.vuejs.org/zh/),专为 [uni-app](https://uniapp.dcloud.io/) 量身打造
14 lines (12 loc) • 516 B
text/typescript
import { Router} from '../options/base';
export const addKeepAliveInclude = function(
router:Router
):void{
// 【Fixe】 https://github.com/SilurianYang/uni-simple-router/issues/316 2021年12月10日14:30:13
const app = getApp();
const keepAliveInclude:Array<string> = app.keepAliveInclude;
if (router.runId === 0 && keepAliveInclude.length === 0) {
const cacheId = app.$route.meta.name + '-' + app.$route.params.__id__;
app.keepAliveInclude.push(cacheId)
}
}