小程序相关

1.右侧胶囊宽度,胶囊和文本重合问题

javascript 复制代码
// #ifdef MP-WEIXIN
// 获取胶囊左边界坐标
const { left } = uni.getMenuButtonBoundingClientRect()
this.rightSafeArea = left + 'px'
// #endif

//给到你的内容宽度
<view :style="{'max-width':rightSafeArea}">

2.在uview组件上修改样式不会生效,需要在外面套view

或者是在小程序开发工具中看下没有生效的view样式类名,用::v-deep写样式,h5和小程序用条件编译

3.顶部导航栏

顶部为搜索栏,可以获取胶囊信息设置

javascript 复制代码
const { height, top } = uni.getMenuButtonBoundingClientRect()
let statusBarHeight
uni.getSystemInfo({
	success: (e) => {
        statusBarHeight=e.statusBarHeight
    }
})
this.height= height + (top - statusBarHeight) * 2;

顶部为左侧返回按钮,中间为文本

javascript 复制代码
statusBar = e.statusBarHeight
const custom = wx.getMenuButtonBoundingClientRect()
customBar = custom.bottom + custom.top - e.statusBarHeight
//整个导航栏高度
:style="{'height':customBar+'px'}"
//标题内容
:style="{'line-height':statusBar+'px','margin-top':(customBar/2)+'px'}"

4.小程序底部占位

底部安全距离padding-bottom: env(safe-area-inset-bottom);

相关推荐
fengGer的bugs6 分钟前
微信小程序版「死了么APP」,它来了
微信小程序·小程序·死了么·死了么app
我的86呢!7 分钟前
微信小程序蓝牙配网
微信小程序·小程序
花卷HJ15 分钟前
【微信小程序】open-type=“contact“ 客服按钮样式无法设置?隐藏 button + label 触发完美解决
微信小程序·小程序·notepad++
康小庄15 分钟前
通过NGINX实现将小程序HTTPS请求转为内部HTTP请求
java·spring boot·nginx·spring·http·小程序
说私域41 分钟前
创作生命力与个体价值:基于AI大模型、AI智能名片与商城小程序的视角
人工智能·小程序·开源·流量运营
weixin_177297220691 小时前
短剧小程序:引领碎片化娱乐新潮流
小程序·娱乐
qq_12498707531 小时前
基于springboot的文化旅游小程序(源码+论文+部署+安装)
java·spring boot·后端·微信小程序·小程序·毕业设计·旅游
小小王app小程序开发13 小时前
抽赏小程序特殊赏玩法开发全解析:技术实现+架构支撑+合规落地
小程序·架构
江南西肥肥14 小时前
从手绘图到小程序,我用AI花了2个小时完成
小程序·vibecoding·claudecode