多个页面引入同一个组件,会缓存改组件吗
发布于 6 年前 作者 xiulanzhong 3651 次浏览 来自 问答

多个页面引入同一个组件,会缓存改组件吗

2 回复

引用的是自定义组件吗?自定义组件分成两个部分,Webview端和逻辑端,逻辑端的线程自始至终只有一个,所以肯定有缓存一些结构。但是新开一个页面,就是一个新的Webview,所以Webview端每次都需要一些自定义组件的初始化消耗。

下面这样的自定义菜单,每次切换页面,会有闪烁,体验不太好,怎么解决呢,

<!–pages/components/footer/footer.wxml–>

<!-- 底部导航 -->

<view class=‘footer’ >

<view class=‘icon-item’ catchtap=‘bindNavi’ data-page=’/pages/home/home’>

<image src=’{{currentPage==“home”?"/res/img/footer/[email protected]":"/res/img/footer/[email protected]"}}’ class=‘icon’></image>

<text class=’{{currentPage==“home”?“active”:""}}’>首页</text>

</view>

<view class=‘icon-item’ catchtap=‘bindNavi’ data-page=’/packageA/discovery/discovery’>

<image src=’{{currentPage==“discovery”?"/res/img/footer/[email protected]":"/res/img/footer/[email protected]"}}’ class=‘icon’></image>

<text class=’{{currentPage==“discovery”?“active”:""}}’>发现</text>

</view>

<view class=‘icon-item’ catchtap=‘bindNavi’ data-page=’/packageA/personalCenter/personalCenter’>

<image src=’{{currentPage==“personalCenter”?"/res/img/footer/[email protected]":"/res/img/footer/[email protected]"}}’ class=‘icon’></image>

<text class=’{{currentPage==“personalCenter”?“active”:""}}’>我的</text>

</view>

</view>

回到顶部