Skip to content

Commit 7888ca3

Browse files
committed
feat: 发布到 H5 平台的配置
1 parent 2f7e439 commit 7888ca3

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

‎h5.json‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"h5": {
3+
"template": "index.html",
4+
"router": {
5+
"mode": "history",
6+
"base": "/h5/"
7+
}
8+
}
9+
}

‎index.html‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!DOCTYPE html>
2+
<html lang="zh-CN">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
7+
<title>
8+
<%= htmlWebpackPlugin.options.title %>
9+
</title>
10+
<script>
11+
var UA = window.navigator.userAgent.toLowerCase();
12+
var isAndroid = UA.indexOf('android') > 0;
13+
var isIOS = /iphone|ipad|ipod|ios/.test(UA);
14+
if (!(isAndroid || isIOS)) {
15+
window.location.href = '/h5/pcguide.html';
16+
}
17+
</script>
18+
<script>
19+
document.addEventListener('DOMContentLoaded', function() {
20+
document.documentElement.style.fontSize = document.documentElement.clientWidth / 20 + 'px'
21+
})
22+
</script>
23+
<link rel="stylesheet" href="<%= htmlWebpackPlugin.options.baseUrl %>static/index.css" />
24+
</head>
25+
<body>
26+
<noscript>
27+
<strong>Please enable JavaScript to continue.</strong>
28+
</noscript>
29+
<div id="app"></div>
30+
<!-- built files will be auto injected -->
31+
<script>
32+
var _hmt = _hmt || [];
33+
(function() {
34+
var hm = document.createElement("script");
35+
hm.src = "https://hm.baidu.com/hm.js?fe3b7a223fc08c795f0f4b6350703e6f";
36+
var s = document.getElementsByTagName("script")[0];
37+
s.parentNode.insertBefore(hm, s);
38+
})();
39+
</script>
40+
</body>
41+
</html>

0 commit comments

Comments
 (0)