perf(components): 添加 v-memo指令以优化性能

- 在 AppFooter 组件中,为最外层 div 添加 v-memo="[active]" 指令- 在 AppHeader 组件中,为 VanNavBar 组件添加 v-memo="[title, fullLive, showLeftArrow, subTitle]" 指令
- 移除了 AppHeader 组件中的 console.log 语句
This commit is contained in:
xingyy 2025-01-23 15:28:31 +08:00
parent a6a5c20705
commit 2d909b276b
2 changed files with 3 additions and 4 deletions

View File

@ -18,7 +18,7 @@ onMounted(()=>{
</script>
<template>
<div v-if="show">
<div v-if="show" v-memo="[active]" >
<van-tabbar v-model="active" route placeholder fixed>
<van-tabbar-item replace to="/">
<span>{{ $t('tabbar.home') }}</span>

View File

@ -30,13 +30,12 @@ const subTitle = computed(() => {
return route.meta.subTitle ? t(route.meta.subTitle) : ''
})
const showLeftArrow = computed(() => route.name && routeWhiteList.includes(route.name))
console.log('route.meta.i18n',route.meta.i18n)
console.log('t(route.meta.i18n)',route.meta.i18n)
console.log('route.meta.title',route.meta.title)
</script>
<template>
<VanNavBar
v-memo="[title,fullLive,showLeftArrow,subTitle]"
:title="title"
:left-arrow="!showLeftArrow||fullLive"
placeholder clickable fixed