html52.com
我爱小程序-开发者交流社区

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

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

网友回复

raphealguo:

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

nigel:

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

<!--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/footercompo-home-icon@3x.png":"/res/img/footer/footercompo-home-icongray@3x.png"}}' 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/footercompo-finder-icon@3x.png":"/res/img/footer/footercompo-finder-icongray@3x.png"}}' 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/footercompo-my-icon@3x.png":"/res/img/footer/footercompo-my-icongray@3x.png"}}' class='icon'></image>

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

</view>

</view>


评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付