主页面片段:
<loading hidden="{{!isLoading}}">加载中...</loading>
<template wx:if="{{!isLoading}}" is="question-list" data="{{answers,layerlayer,swiper}}" />
<mp-halfScreenDialog show="{{showCalendar}}">
<view slot="title">每日一练</view>
<view slot="desc">
<calendar calendarConfig="{{calendarConfig}}" bind:onTapDay="onTapDay" bind:afterCalendarRender="afterCalendarRender"></calendar>
</view>
</mp-halfScreenDialog>
模板片段:
<view hidden="{{!layerlayer.isLayerShow}}" class="footer-layer" bindtap="layerFooterClick"></view>
<view class="footer" animation="{{layerlayer.layerAnimation}}">
<view class="count">
<view class="collect" wx:if="{{!answers.allList[answers.activeNum].isStore}}" bindtap="collectList">收藏</view>
<view class="collect active" wx:else bindtap="collectList">收藏</view>
<view class="page" bindtap='pageClick'>{{answers.activeNum + 1}}/{{answers.allList.length}}</view>
<view class="success">{{answers.success}}</view>
<view class="error">{{answers.error}}</view>
</view>
<template is="layer" data="{{answers,layerlayer}}" />
js片段:
//页码切换列表效果
pageClick: function () {
let layerAnimation = wx.createAnimation({
transformOrigin: '50% 50%',
duration: 500,
timingFunction: 'ease',
delay: 0
})
if (!this.data.layerlayer.isLayerShow) {
layerAnimation.translate3d(0, 0, 0).step()
} else {
layerAnimation.translate3d(0, '100%', 0).step()
}
this.data.layerlayer.isLayerShow = !this.data.layerlayer.isLayerShow
this.data.layerlayer.layerAnimation = layerAnimation
this.setData(this.data)
},
//页码切换列表收缩
layerFooterClick: function () {
let layerAnimation = wx.createAnimation({
transformOrigin: '50% 50%',
duration: 500,
timingFunction: 'ease',
delay: 0
})
layerAnimation.translate3d(0, '100%', 0).step()
this.data.layerlayer.isLayerShow = false
this.data.layerlayer.layerAnimation = layerAnimation
this.setData(this.data)
第一种情况:
只触发pageClick事件,则正常显示与隐藏自定义的模板;
第二种情况:
首先触发一下mp-halfScreenDialog组件,让它显示并关闭,然后再触发pageClick时,总是会在最顶层显示mp-halfScreenDialog,然后再它下面才显示自定义的模板。
怀疑mp-halfScreenDialog关闭的不彻底。
你好,真机有问题吗?麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)