美文网首页
微信小程序内组件的show函数不触发

微信小程序内组件的show函数不触发

作者: IamaStupid | 来源:发表于2022-03-18 18:37 被阅读0次

组件的show函数不触发

// 组件
pageLifetimes: {
        show: function() {
            console.log('threeStep 组件 show....')
            // 页面被展示
        },
        hide: function() {
          // 页面被隐藏
        },
        resize: function(size) {
          // 页面尺寸变化
        }
}

修改后可以触发:

// 使用组件的主页面
<!-- display:none/block;这样写才能出发show函数 -->
<view style="display:{{(loginState && hasThreeStep === 1)?'block':'none'}}" class="step-three">
<!-- <view wx:if="{{loginState && hasThreeStep === 1}}" class="step-three"> -->
        <three-step></three-step>
</view>

相关文章

网友评论

      本文标题:微信小程序内组件的show函数不触发

      本文链接:https://www.haomeiwen.com/subject/mrhwdrtx.html