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>
相关推荐
云上凯歌2 天前
01_AI工具平台项目概述.md
人工智能·python·uni-app
郑州光合科技余经理2 天前
O2O上门预约小程序:全栈解决方案
java·大数据·开发语言·人工智能·小程序·uni-app·php
2501_916008892 天前
在不越狱前提下导出 iOS 应用文件的过程,访问应用沙盒目录,获取真实数据
android·macos·ios·小程序·uni-app·cocoa·iphone
2501_915106322 天前
Android和IOS 移动应用App图标生成与使用 Assets.car生成
android·ios·小程序·https·uni-app·iphone·webview
木子啊2 天前
UNIAPP移动端瀑布流列表,支持APP、微信小程序、H5
uni-app·瀑布流·两列排序
2501_915918412 天前
Mac 抓包软件有哪些?Charles、mitmproxy、Wireshark和Sniffmaster哪个更合适
android·ios·小程序·https·uni-app·iphone·webview
2501_915106322 天前
iOS 抓包绕过 SSL 证书认证, HTTPS 暴力抓包、数据流分析
android·ios·小程序·https·uni-app·iphone·ssl
WeiAreYoung2 天前
uni-app xcode 制作iOS Notification Service Extension 远程推送图文原生插件
ios·uni-app·xcode
2501_915921432 天前
iOS App 电耗管理 通过系统电池记录、Xcode Instruments 与克魔(KeyMob)组合使用
android·ios·小程序·https·uni-app·iphone·webview
2501_915918412 天前
iOS App 测试方法,Xcode、TestFlight与克魔(KeyMob)等工具组合使用
android·macos·ios·小程序·uni-app·iphone·xcode