-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 自定义keepAlive缓存支持无name缓存,支持不同路由同一组件复用时分别缓存
- Loading branch information
1 parent
43e7b93
commit 8cf313c
Showing
61 changed files
with
634 additions
and
566 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" href="/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>me-admin</title> | ||
</head> | ||
|
||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" href="/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>me-admin</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.ts"></script> | ||
</body> | ||
|
||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.ts"></script> | ||
</body> | ||
|
||
</html> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,4 +51,4 @@ | |
"vite-svg-loader": "^3.4.0", | ||
"vue-tsc": "^0.34.7" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
import { queuePostFlushCb, SuspenseBoundary} from "vue" | ||
import { queuePostFlushCb, SuspenseBoundary } from "vue" | ||
import { isArray } from "@vue/shared" | ||
export function queueEffectWithSuspense( | ||
fn: Function | Function[], | ||
suspense: SuspenseBoundary | null | ||
): void { | ||
if (suspense && suspense.pendingBranch) { | ||
if (isArray(fn)) { | ||
suspense.effects.push(...fn) | ||
} else { | ||
suspense.effects.push(fn) | ||
} | ||
fn: Function | Function[], | ||
suspense: SuspenseBoundary | null | ||
): void { | ||
if (suspense && suspense.pendingBranch) { | ||
if (isArray(fn)) { | ||
suspense.effects.push(...fn) | ||
} else { | ||
queuePostFlushCb(fn) | ||
suspense.effects.push(fn) | ||
} | ||
} else { | ||
queuePostFlushCb(fn) | ||
} | ||
} | ||
|
||
export const isSuspense = (type: any): boolean => type.__isSuspense | ||
|
||
export const isSuspense = (type: any): boolean => type.__isSuspense | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { ComponentInternalInstance } from "vue" | ||
|
||
export interface ComponentRenderContext { | ||
[key: string]: any | ||
_: ComponentInternalInstance | ||
} | ||
[key: string]: any | ||
_: ComponentInternalInstance | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,52 @@ | ||
import { number } from "@intlify/core-base" | ||
import { ComponentInternalInstance, devtools } from "vue" | ||
const enum DevtoolsHooks { | ||
APP_INIT = 'app:init', | ||
APP_UNMOUNT = 'app:unmount', | ||
COMPONENT_UPDATED = 'component:updated', | ||
COMPONENT_ADDED = 'component:added', | ||
COMPONENT_REMOVED = 'component:removed', | ||
COMPONENT_EMIT = 'component:emit', | ||
PERFORMANCE_START = 'perf:start', | ||
PERFORMANCE_END = 'perf:end' | ||
} | ||
APP_INIT = 'app:init', | ||
APP_UNMOUNT = 'app:unmount', | ||
COMPONENT_UPDATED = 'component:updated', | ||
COMPONENT_ADDED = 'component:added', | ||
COMPONENT_REMOVED = 'component:removed', | ||
COMPONENT_EMIT = 'component:emit', | ||
PERFORMANCE_START = 'perf:start', | ||
PERFORMANCE_END = 'perf:end' | ||
} | ||
export const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook( | ||
DevtoolsHooks.COMPONENT_ADDED | ||
) | ||
DevtoolsHooks.COMPONENT_ADDED | ||
) | ||
|
||
function createDevtoolsComponentHook(hook: DevtoolsHooks) { | ||
return (component: ComponentInternalInstance) => { | ||
emit( | ||
hook, | ||
component.appContext.app, | ||
component.uid, | ||
component.parent ? component.parent.uid : undefined, | ||
component | ||
) | ||
} | ||
function createDevtoolsComponentHook(hook: DevtoolsHooks) { | ||
return (component: ComponentInternalInstance) => { | ||
emit( | ||
hook, | ||
component.appContext.app, | ||
component.uid, | ||
component.parent ? component.parent.uid : undefined, | ||
component | ||
) | ||
} | ||
} | ||
|
||
function emit(event: string, ...args: any[]) { | ||
if (devtools) { | ||
devtools.emit(event, ...args) | ||
} | ||
//TODO::因为拿不到devtoolsNotInstalled和buffer这里做特别处理 | ||
// else if (!devtoolsNotInstalled) { | ||
// buffer.push({ event, args }) | ||
// } | ||
} | ||
function emit(event: string, ...args: any[]) { | ||
// if (devtools) { | ||
// return devtools.emit(event, ...args) | ||
// } else if (!devtoolsNotInstalled) { | ||
// buffer.push({ event, args }) | ||
// } | ||
//TODO::因为拿不到devtoolsNotInstalled和buffer这里只在devtools Installed 成功后处理 | ||
if (devtools) { | ||
return devtools.emit(event, ...args) | ||
} | ||
//TODO::因为拿不到devtoolsNotInstalled和buffer这里做特别处理 | ||
// const doEmit = (event: string,frequency:number,...args: any[])=>{ | ||
// if (devtools) { | ||
// return devtools.emit(event, ...args) | ||
// } | ||
// if(frequency > 3){ | ||
// return console.warn('devtools is Not installed'); | ||
// } | ||
// setTimeout(() => { | ||
// doEmit(event,frequency++,...args); | ||
// }, 1000); | ||
// } | ||
// doEmit(event,1,args); | ||
} |
Oops, something went wrong.