关于图标的显示不全问题overflow-hidden

在这里插入图片描述
直接上图了,上面就是错误的bug的地方

找了好久的呀,用的是vue+iview的项目,然后用的是iview的slider滑块,看的demo都是合适的(其实并咩有看的很仔细,因为就是和原来的代码不一样)
因为我们重置了原来代码的样式,所以是导致了这边多了一个overflow:hidden;
当时找了好几遍咩有考虑到这个问题,其实图片不显示能很明显想到的是:
1、上面的高度不够
2、overflow:hidden给隐藏了

总结:所以给重置样式的时候要稍微留意了,有可能会把其他的地方用到的给重置了,还很难发现,其实有时候也可以发现的,就是细心地找右边的样式的,发现覆盖的地方
还有问题出现了,要有思路,就是根据当前的隐藏了部分图标,想到会引起这个问题的可能性

<template> <view class="h-full w-full bg-black-5 flex flex-col justify-stretch overflow-hidden"> <custom-nav-bar></custom-nav-bar> <!-- 背景图片 --> <view :style="{'background-image': cacheStore.historyPlays[0].al.picUrl?`url(${cacheStore.historyPlays[0].al.picUrl})`:'/static/logo.png'}" class="bg-60% bg-no-repeat absolute inset-0 w-full h-full object-cover scale-[1.1] blur-md overflow-hidden"> </view> <UserDetailTop class="z-10" :items="cacheStore.historyPlays[0]" :description="description"></UserDetailTop> <view class="z-20 rounded-tl-[18rpx] rounded-tr-[18rpx] bg-black-5 grow relative"> <view class="!h-full absolute left-0 right-0 bottom-0"> <Subtitle icon="icon-menu" icon-size="63rpx" class="!justify-end bg-black-5 px-[52rpx] h-[63rpx]" :style="{ top: 44 + useStatusBarHeight().value + 'px' }"> <template #title> <text class="text-grey-15 inline-block align-middle mr-[15rpx] font-[30rpx]"> 播放部 </text> <view class="flex items-center h-[65rpx]"> <button class="h-[63rpx] w-[63rpx] m-0 rounded-full bg-blue-1 text-white-3 flex justify-center items-center" @tap="audioStore.onPlay(audioStore.mode === 'random' ? rangeRandom(0, cacheStore.historyPlays.length) : 0, cacheStore.historyPlays)"> <JIcon class="icon-ic_play_rc text-[42rpx]" /> </button> </view> </template> </Subtitle> <view class="box-border overflow-y-scroll h-full pt-[26rpx] pb-[var(--save-bottom)]"> <!-- #ifdef H5 --> <H5BackTransition :ref="(el: any) => el?.open()" class="h-full"> <!-- #endif --> <view class="h-full animate-enter-content bg-black-5 px-[28rpx] after:block"> <Song v-for="(song, index) in cacheStore.historyPlays" :key="song.id" class="animate-content" :song="song" :is-play="audioStore.currentSongInfo?.song.id === song.id && audioStore.isPlay" :is-run="audioStore.currentSongInfo?.song.id === song.id" :cannot-play="audioStore.currentSongInfo?.song.id === song.id && !audioStore.currentSongInfo?.urlInfo.url" @click="audioStore.onPlay(index, cacheStore.historyPlays.slice())" /> </view> <!-- #ifdef H5 --> </H5BackTransition> <!-- #endif --> </view> </view> </view> </view> <PlayController /> </template>
03-15
### UniApp H5 平台 TabBar 显示解决方案 在开发过程中遇到 **TabBar 图片无法正常显示** 或者 **TabBar 被遮挡/显示** 的问题时,可以按照以下方法逐一排查并解决问题。 #### 1. 确认图片路径是否正确 如果 `tabBar` 中的图片未加载成功,需确认配置文件中的路径是否无误。通常情况下,`tabBar` 配置项位于项目的 `manifest.json` 文件中。以下是常见的配置方式: ```json { "tabBar": { "list": [ { "pagePath": "pages/index/index", "text": "首页", "iconPath": "static/images/home.png", // 默认状态图标 "selectedIconPath": "static/images/home-active.png" // 选中状态图标 } ] } } ``` 确保 `iconPath` 和 `selectedIconPath` 所指向的资源能够被项目访问到[^1]。 --- #### 2. 检查 CSS 样式冲突 当运行环境切换至 H5 平台时,可能会因为样式覆盖或者屏幕适配问题导致 `tabBar` 展示。可以通过以下方式进行调整: - 添加局样式的重置规则,防止外部框架干扰: ```css * { margin: 0; padding: 0; box-sizing: border-box; } /* 特殊处理 iPhone X 及以上设备的安区域 */ html, body { height: 100%; overflow-x: hidden; } .tab-bar-container { position: fixed; bottom: 0; width: 100%; background-color: white; /* 设置背景颜色避免透明效果 */ } ``` 对于 iOS 设备底部安区的支持,可利用 `env()` 函数动态计算高度差值[^2]: ```css .tab-bar-container { padding-bottom: env(safe-area-inset-bottom); } ``` 此设置会自动适应同型号的 iPhone 底部圆角设计,从而避免因系统导航栏造成的视觉错位现象。 --- #### 3. 使用 API 获取设备参数 通过调用 `uni.getSystemInfoSync()` 方法获取当前设备的具体尺寸数据,并据此优化布局逻辑。例如,在初始化页面时执行如下代码片段来判断是否存在额外的空间需求: ```javascript const systemInfo = uni.getSystemInfoSync(); if (systemInfo.safeAreaInsets && systemInfo.safeAreaInsets.bottom > 0) { console.log('存在底部安边距:', systemInfo.safeAreaInsets.bottom); } else { console.log('无需特殊处理'); } ``` 上述脚本可以帮助开发者了解目标终端是否有特殊的 UI 布局约束条件需要满足。 --- #### 4. 更新依赖库版本 部分旧版工具链可能未能妥善支持某些新特性(如 Safe Area),因此建议升级至最新稳定发行版后再尝试重现问题。具体操作步骤包括但限于以下几个方面: - 升级 CLI 工具; - 替换基础组件模板; - 修改编译选项以启用实验性质的功能开关等。 注意:每次变更前务必做好备份工作以防意外丢失重要资料! --- ### 总结 综上所述,针对 UniApp 在 H5 场景下发生的 TabBar 渲染异常状况可以从四个方面入手分析解决办法——验证素材链接有效性、审查前端表现层定义语句、借助原生接口探测硬件属性以及适时跟进官方文档指导完成必要的技术迭代过程。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值