k***@163.com
k***@163.com
  • 发布:2021-07-30 17:13
  • 更新:2021-07-30 17:13
  • 阅读:1761

开发H5如何做到双指拉伸禁止浏览器的缩放行为

分类:HTML5+

开发H5如何做到双指拉伸禁止浏览器的缩放行为

项目中使用了echarts的缩放,现在问题是会带动浏览器页面缩放,所以要做禁止浏览器缩放行为。

网上答案都是加上禁止缩放的meta创建的是uniapp项目,因为uniapp项目默认是没有index.html的,查了文档要自定义模板,在根目录创建了index.html,用了在hello uni-app示例中有一个template.h5.html文件,并且在manifest中H5配置中关联了index.html,但是没有效果,大佬们,我该怎么办?

meta如下:

<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">,

index.html内容

<html lang="zh-CN">  
<head>  
<meta charset="utf-8">  
<meta http-equiv="X-UA-Compatible" content="IE=edge">  
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">  
<title>  
<%= htmlWebpackPlugin.options.title %>  
</title>  
<!-- 正式发布的时候使用,开发期间不启用。↓ -->  
<!-- <script src="/h5/touch-emulator.js"></script>  
<script>  
TouchEmulator();  
if (document.documentElement.clientWidth > 1024) {  
window.location.href = '/h5/pcguide.html#'+location.pathname+location.search;  
}  
</script>  
<style>  
::-webkit-scrollbar{  
display: none;  
}  
</style>  
<script>  
var _hmt = _hmt || [];  
(function() {  
var hm = document.createElement("script");  
hm.src = "https://hm.baidu.com/hm.js?";// 百度统计key  
var s = document.getElementsByTagName("script")[0];  
s.parentNode.insertBefore(hm, s);  
})();  
</script> -->  
<!-- 正式发布的时候使用,开发期间不启用。↑ -->  
<script>  
// document.addEventListener('DOMContentLoaded', function() {  
//  document.documentElement.style.fontSize = document.documentElement.clientWidth / 20 + 'px'  
// })  
</script>  
<link rel="stylesheet" href="<%= BASE_URL %>static/index.<%= VUE_APP_INDEX_CSS_HASH %>.css" />  
</head>  
<body>  
<!-- 该文件为 H5 平台的模板 HTML,并非应用入口。 -->  
<!-- 请勿在此文件编写页面代码或直接运行此文件。 -->  
<!-- 详见文档:https://uniapp.dcloud.io/collocation/manifest?id=h5-template -->  
<noscript>  
<strong>Please enable JavaScript to continue.</strong>  
</noscript>  
<div id="app"></div>  
<!-- built files will be auto injected -->  
<script>  
/*BAIDU_STAT*/  
</script>  
</body>  
</html>

manifest.json中H5配置 "template" : "index.html"

2021-07-30 17:13 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复