Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

what different with <KeepAlive /> attrs 'id' 'name' 'cacheKey'. #263

Open
akai-cn opened this issue Mar 27, 2023 · 1 comment
Open

what different with <KeepAlive /> attrs 'id' 'name' 'cacheKey'. #263

akai-cn opened this issue Mar 27, 2023 · 1 comment

Comments

@akai-cn
Copy link

akai-cn commented Mar 27, 2023

请问这几个属性之间有什么区别呢,可不可以只填写一个就具有彼此的功能。比如我传递了 cacheKey,就不需要写 name 也可以

@akai-cn akai-cn changed the title what's different with <KeepAlive /> attrs 'id' 'name' 'cacheKey'. what different with <KeepAlive /> attrs 'id' 'name' 'cacheKey'. Mar 27, 2023
@CJY0208
Copy link
Owner

CJY0208 commented Mar 27, 2023

cacheKey: 当前 KeepAlive 在整个应用中的唯一标识,有且仅有一个,类似 DOM 节点中的 id
id: 当前 KeepAlive 在当前节点位置上的唯一标识,用来在同一个节点位置上划分出不同的缓存,类似路由中的参数 /item/:id
name: 主要是用来方便用户找到某个节点并控制这个节点的缓存,类似 DOM 节点中的 class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants