优化详情返回首页停留
This commit is contained in:
@@ -8,6 +8,9 @@ import InAppBrowserPrompt from './components/InAppBrowserPrompt.vue'
|
||||
import AdminLayout from './layouts/AdminLayout.vue'
|
||||
import AppLayout from './layouts/AppLayout.vue'
|
||||
|
||||
/** 移动端从详情返回时保留列表状态与滚动位置 */
|
||||
const mobileKeepAliveIncludes = ['MobileHomeView']
|
||||
|
||||
const route = useRoute()
|
||||
const layout = computed(() => {
|
||||
if (route.path === '/m' || route.path.startsWith('/m/')) {
|
||||
@@ -23,7 +26,11 @@ const layout = computed(() => {
|
||||
<AdminLayout v-if="layout === 'admin'">
|
||||
<RouterView />
|
||||
</AdminLayout>
|
||||
<RouterView v-else-if="layout === 'blank'" />
|
||||
<RouterView v-else-if="layout === 'blank'" v-slot="{ Component }">
|
||||
<KeepAlive :include="mobileKeepAliveIncludes" :max="5">
|
||||
<component :is="Component" />
|
||||
</KeepAlive>
|
||||
</RouterView>
|
||||
<AppLayout v-else>
|
||||
<RouterView />
|
||||
</AppLayout>
|
||||
|
||||
Reference in New Issue
Block a user