小程序相关

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);

相关推荐
cosinmz38 分钟前
PDF 发票合并经验分享:月初高效整理发票的实用方法
经验分享·小程序·pdf·pdf转换·pdf发票合并·发票合并打印
2501_9160074712 小时前
前端开发常用软件与工具全面指南
android·ios·小程序·https·uni-app·iphone·webview
2501_9159090616 小时前
iOS应用性能优化:十大策略提升用户体验与开发效率
android·ios·小程序·https·uni-app·iphone·webview
2601_9567436819 小时前
上海小程序开发公司技术选型指南:Serverless架构如何影响交付质量与长期成本
云原生·小程序·架构·serverless·开发经验·上海
silvia_Anne21 小时前
微信小程序之渲染商品列表
微信小程序·小程序
海兰2 天前
【文字三国志:第六篇】天命重构,UI组件设计细节
人工智能·ui·语言模型·小程序
草根站起来2 天前
微信小程序request net:ERR_CERT_DATE_INVALID
微信小程序·小程序
小北的AI科技分享2 天前
广州小程序平台推荐:2026年本地商家数字化选型深度测评
小程序·广州小程序平台
MageGojo2 天前
10 种主题随机诗词:一个 API 解决小程序的诗词内容源
python·小程序·古诗词·api 接入
青山科技分享2 天前
2026北京小程序平台推荐——本地商家数字化选型全维度解析
小程序·小程序平台推荐