uniapp-H5项目的坑

先推荐个插件库-非常好用:https://ext.dcloud.net.cn/

一、uniapp h5 适配pc端

1、问题:屏幕尺寸在400px~960px之间页面排版错乱

2、解决方法:在page.json文件中

复制代码
"globalStyle": {
		"navigationStyle": "custom",
		"navigationBarTextStyle": "white",
		"navigationBarTitleText": "xxxx项目App",
		"navigationBarBackgroundColor": "#FFFFFF",
		// 以下代码是解决H5适配排版错乱问题的代码
		"rpxCalcMaxDeviceWidth": 0, // rpx 计算所支持的最大设备宽度,单位 px,默认值为 960
		"rpxCalcBaseDeviceWidth": 375, // rpx 计算使用的基准设备宽度,设备实际宽度超出 rpx 计算所支持的最大设备宽度时将按基准宽度计算,单位 px,默认值为 375
		"rpxCalcIncludeWidth": 750 // rpx 计算特殊处理的值,始终按实际的设备宽度计算,单位 rpx,默认值为 750

	}

二、uniapp h5 在手机上底部导航栏上下抖动

1、问题:原因不详

2、解决方法:在App.vue中加入如下代码

复制代码
<style lang="scss">
page{
	height: 100vh !important;
}
</style>

三、uniapp h5 适配 Ios底部小黑条

1、问题:安卓没有小黑条、Ios有小黑条

2、解决方法:在App.vue 样式中加入如下代码

复制代码
padding-bottom: constant(safe-area-inset-bottom) !important;
		/*兼容 IOS<11.2*/
		padding-bottom: env(safe-area-inset-bottom) !important;
		/*兼容 IOS>11.2*/
		/* 可以通过margin-bottom来适配 */
		margin-bottom: constant(safe-area-inset-bottom) !important;
		margin-bottom: env(safe-area-inset-bottom) !important;
		/* 或者改变高度*/
		// height: calc(55px + constant(safe-area-inset-bottom));
		// height: calc(55px + env(safe-area-inset-bottom));
		height: calc(25px +constant(safe-area-inset-bottom)) !important;
		height: calc(25px +env(safe-area-inset-bottom)) !important;

		// height: 100vh !important;

		@supports (bottom: constant(safe-area-inset-bottom)) or (bottom: env(safe-area-inset-bottom)) {
			.bottom-button {
				margin-bottom: constant(safe-area-inset-bottom) !important;
				margin-bottom: env(safe-area-inset-bottom) !important;
			}
		}

四、判断机型的方法(ios还是安卓-可做一些适配)

复制代码
	myapp() {
				console.log('机型', uni.getSystemInfoSync().platform)
				if (uni.getSystemInfoSync().platform == 'ios') {
					// ios
					return true
				}
				// 安卓
				return false
			},

五、uni-easyinput输入框

1、问题:uniapp 原生组件库的输入框 默认输入最大是140字符

2、想要输入字符不受限制(加maxlength='-1')

复制代码
			<uni-easyinput  type="textarea" v-model="value" maxlength='-1' placeholder="请输入内容"></uni-easyinput>
相关推荐
Q_Q5110082851 天前
python+uniapp基于微信小程序的心理咨询信息系统
spring boot·python·微信小程序·django·flask·uni-app·node.js
HuYi_code1 天前
WeChat 小程序下载文件实现
微信小程序·uni-app
00后程序员张1 天前
HTTPS 包 抓取与分析实战,从抓包到解密、故障定位与真机取证
网络协议·http·ios·小程序·https·uni-app·iphone
2501_915921431 天前
iOS混淆与IPA加固实战手记,如何构建苹果应用防反编译体系
android·macos·ios·小程序·uni-app·cocoa·iphone
Q_Q5110082851 天前
python+uniapp基于微信小程序的学院设备报修系统
spring boot·python·微信小程序·django·flask·uni-app
ღ᭄ꦿ࿐Never say never꧂1 天前
微信小程序 Button 组件 open-type 完全指南:从用户信息获取到客服分享的实战应用
spring boot·微信小程序·小程序·uni-app·vue3
你真的可爱呀1 天前
uniapp学习【路由跳转 +数据请求+本地存储+常用组件】
前端·学习·uni-app
2501_915106322 天前
iOS 26 APP 性能测试实战攻略:多工具组合辅助方案
android·macos·ios·小程序·uni-app·cocoa·iphone
00后程序员张2 天前
iOS混淆与IPA文件加固全流程实战 防止苹果应用被反编译的工程级方案
android·ios·小程序·https·uni-app·iphone·webview
草字2 天前
uniapp 打开横竖屏。usb调试时可以横竖屏切换,但是打包发布后却不行?
java·前端·uni-app