黑子
黑子
  • 发布:2020-04-18 22:04
  • 更新:2020-04-18 22:04
  • 阅读:2566

uniapp开发中,rpx,upx,px 能实现动态转换吗?

分类:uni-app

界面布局是这样的,最顶部是顶部导航bar,导航bar下面是菜单栏tab,底部有一个bar,中间是内容区域,
点击菜单栏 上的tab,内容区可以左右切换
我的实现方案是,用屏幕可用区域高度 - 导航bar - 菜单tab - 底部bar,这样来得到内容区域高度,然后把这个高度固定

<view>  
            <swiper  
                class="swiper"  
                :indicator-dots="false"  
                :autoplay="false"  
                :interval="1000"  
                :duration="1000"  
                :circular="true"  
                :current="tab.index"                  
                @change="onTabSelect"  
                                :style="[{ height:(window.height - customBar - barHeight - barHeight) + 'upx' }]"  
            >  
                <swiper-item>  
                    <scroll-view :scroll-y="true" :show-scrollbar="false" @scroll="rscroll" :scroll-top="scrollTop"  
                    :style="[{ height:(window.height - customBar - barHeight - barHeight) + 'px' }]">  
                        <recommend ref="recommend" v-show="tab.selectid === 0"></recommend>  
                    </scroll-view>  
                </swiper-item>  
            </swiper>  
        </view>

在开发中,顶部菜单默认高度90rpx,在手机上显会转换成45px,在ipad上就会变成122px,

使用uni.getSystemInfo 得到的信息都是px单位,customBar , barHeight 单位都是像素,然而到ipad上这个高度就变大了,以至于内容区域无法上下重合

请问怎么解决啊

2020-04-18 22:04 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复