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

请问如何进行微应用缓存,有点没太看懂 #2

Closed
NINGyv179 opened this issue Nov 29, 2022 · 3 comments
Closed

请问如何进行微应用缓存,有点没太看懂 #2

NINGyv179 opened this issue Nov 29, 2022 · 3 comments

Comments

@NINGyv179
Copy link

image

@MAXLZ1
Copy link
Owner

MAXLZ1 commented Nov 29, 2022

利用vue的keep-alive进行缓存,实现思路就是在主应用中新建一个页面用来展示子应用的某个页面,然后将这个页面添加到keep-alive的include中。这样做的缺点就是,对于每个子应用需要缓存的页面都需要在主应用新建一个页面。

@NINGyv179
Copy link
Author

利用vue的keep-alive进行缓存,实现思路就是在主应用中新建一个页面用来展示子应用的某个页面,然后将这个页面添加到keep-alive的include中。这样做的缺点就是,对于每个子应用需要缓存的页面都需要在主应用新建一个页面。

我试了一下,但是每次都是会重新请求,难道是因为我没用loadMicroApp,而是用registerMicroApps的原因

@MAXLZ1
Copy link
Owner

MAXLZ1 commented Nov 29, 2022

用loadMicroApp加载可以,registerMicroApps会根据url的变化进行加载。

onMounted(() => {
app = loadMicroApp({
name: 'reactAppKeepAlive',
entry: reactAppEntry,
container: container.value!,
props: {
path: '/reactApp/tab-view'
}
})
})

@MAXLZ1 MAXLZ1 closed this as completed Dec 1, 2022
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