场景-uniapp-微信小程序- 弹窗在scroll-view 中
问题是:
<scroll-view class="business-scroll" scroll-x="true" show-scrollbar="false">
<view v-for="(item, index) in rentingList" >
<组件>
<弹窗></弹窗>
</组件>
</view>
</scroll-view>
以上滚动列表 组件中 需要有弹窗 但是直接弹 就会出现 弹窗 在 scroll-view 的顶部 没有在整个屏幕上弹
解决方法:
使用root-portal 标签包括弹窗内容,
root-portal 使整个子树从页面中脱离出来,类似于在 CSS 中使用 fixed position 的效果。主要用于制作弹窗、弹出层等。
官方文档:https://developers.weixin.qq.com/miniprogram/dev/component/root-portal.html
<scroll-view class="business-scroll" scroll-x="true" show-scrollbar="false">
<view v-for="(item, index) in rentingList" >
<组件>
<root-portal>
<弹窗></弹窗>
</root-portal>
</组件>
</view>
</scroll-view>
这样 弹窗就能在整个屏幕弹
更多推荐
所有评论(0)