在swiper组件内的root-portal组件,在开发工具里运行正常,在真机运行的环境下,无法脱离swiper。
<swiper class="swiper-container">
<swiper-item class="swiper-item">
<button bindtap="toggle">显示 root-portal</button>
<root-portal wx:if="{{ show }}">
<view class="portal-content">
root-portal 内容
</view>
</root-portal>
</swiper-item>
</swiper>
.swiper-container{
width: 100%;
height: 50vh;
}
.portal-content {
position: absolute;
left: 40px;
top: 40px;
right: 40px;
bottom: 40px;
text-align: center;
padding: 20px;
background-color: #ddd;
}
const app = getApp()
Page({
data: {
show: false,
},
toggle() {
this.setData({
show: !this.data.show,
})
},
})
真机环境下:
开发工具:
安卓哪个版本哪个机型,我这边华为无法复现
代码片段:
https://developers.weixin.qq.com/s/lRCRFjmH7dCc