@dongkboy 1 месяц назад
Родитель
Сommit
223ed65ce9
2 измененных файлов с 56 добавлено и 25 удалено
  1. 24 24
      index.html
  2. 32 1
      style/zcm-main.css

+ 24 - 24
index.html

@@ -4,8 +4,7 @@
 		<meta charset="utf-8">
 		<meta http-equiv="X-UA-Compatible" content="IE=edge">
 		<meta name="referrer" content="no-referrer" />
-		<meta name="viewport"
-			content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
 		<title><%= htmlWebpackPlugin.options.title %></title>
 
 		<script>
@@ -17,34 +16,34 @@
 				// window.location.href = '/demo/picture/website/pcguide.html';
 			}
 		</script>
+
 		<script>
 			document.addEventListener('DOMContentLoaded', function() {
-				document.documentElement.style.fontSize = document.documentElement.clientWidth / 20 + 'px'
+				// document.documentElement.style.fontSize = document.documentElement.clientWidth / 20 + 'px'
 			})
 		</script>
 		<link rel="stylesheet" href="<%= BASE_URL %>static/index.css" />
-		<style>
-			/* #ifdef H5 */
-			/* 在桌面浏览器中限制宽度为375px并居中显示 */
-			@media screen and (min-width: 375px) {
-				body {
-					background-color: #f5f5f5;
-					display: flex;
-					justify-content: center;
-					align-items: flex-start;
-					min-height: 100vh;
-					margin: 0;
-					padding: 0;
-				}
-				.uni-app--maxwidth {
-					width: 400px;
-					min-height: 100vh;
-					background-color: #ffffff;
-					box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
-				}
+		<!-- <style>
+			/* H5 浏览器端:移动端模拟器容器样式 */
+			html, body {
+				margin: 0;
+				padding: 0;
+				background: #f5f5f5;
+				height: 100%;
+				overflow: hidden;
+			}
+			
+			#app-wrapper {
+				width: 375px;
+				margin: 0 auto;
+				position: relative;
+				height: 100%;
+				background: #fff;
+				box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
+				overflow-y: auto;
 			}
-			/* #endif */
-		</style>
+		</style> -->
+
 	</head>
 	<body>
 		<!-- 该文件为 H5 平台的模板 HTML,并非应用入口,请勿直接运行此文件。 -->
@@ -52,6 +51,7 @@
 		<noscript>
 			<strong>Please enable JavaScript to continue.</strong>
 		</noscript>
+		<!-- H5 浏览器端:添加包裹容器模拟移动端效果 -->
 		<div id="app"></div>
 		<!-- 微信SDK文件 -->
 		<script src="<%= BASE_URL %>static/mp-h5/jweixin-1.4.0.js"></script>

+ 32 - 1
style/zcm-main.css

@@ -1214,4 +1214,35 @@ body {
 
 .pr-5 {
 	padding-right: 50upx;
-}
+}
+
+
+/* #ifdef H5 */
+uni-page {
+	max-width: 375px;
+	margin: 0  auto;
+	box-shadow: 0 0 10upx rgba(0, 0, 0, 0.1);
+}
+
+.uni-tabbar,
+.header,
+.u-popup,
+.u-popup__content,
+.uni-page-head,
+.footer,
+.uni-navbar {
+	max-width: 375px;
+	margin: 0 auto;
+	left: 0;
+	right: 0;
+}
+
+
+.u-popup__content {
+	width: 375px;
+	margin: 0 auto;
+
+}
+
+
+/* #endif */