1、使用uni-app自带的tabBar,当点击过一次之后就不会刷新的问题:
将onLoad里的方法全部移到onShow里面去
2、去掉顶部导航栏
1、"navigationStyle": "custom"
2、"app-plus": {
"titleNView": false,
"bounce": "none"
} (会导致APP的导航栏也祈祷)
3、宽度使用upx,不能进行计算,所以宽度不会根据改变而改变
4、uni-app的顶部导航栏,返回重置数据使用 onBackPress
5、在view图文列表中,使用@tap没有反应,可改为@click
6、uni-app打包生成H5,可用document.title = '',设置应用的名称
7、有些地方的样式宽度设置一个最小宽度,避免出现缩放的问题
8、uni-app打包H5在弱网的情况下出现了“网络不给力,点击重试”的问题:
在manifest.json中设置sync,详见:https://uniapp.dcloud.io/collocation/manifest?id=h5-async
9、文本框触发回车事件
<input type="text" confirm-type="search" @confirm="search()" />
10、APP锁定屏幕方向
//#ifdef APP-PLUS
plus.screen.lockOrientation('portrait-primary'); //锁定屏幕方向
//#endif
11、修改switch的背景颜色和大小
<switch name="switch" @change="couponChange" checked color="#ff4964" style="transform:scale(0.7)" />
12、uni-app添加遮罩层mask,遮罩下的页面可以滚动,添加
document.body.style.position = 'fixed';
当去掉遮罩时,将body改为static
document.body.style.position = 'static';
13、正式适配去掉一些字符
name.replace(/[&\;\\\"、,。_包邮免费折扣!\-]/g,'')
14、移动端H5调起系统的复制功能的CSS写法
-webkit-touch-callout: all;
-webkit-user-select: all;
-moz-user-select: all;
-ms-user-select: all;
user-select: all;
15、定位到某个位置
document.getElementById("id").scrollIntoView();
16、当出现蒙版时,将body里的内容固定
document.body.style.position = 'static';
document.body.style.position = 'fixed';
17、蒙版
position: fixed;
top: 0;
left: 0;
z-index: 999;
width: 100%;
height: 100vh;
background: rgba(0, 0, 0, 0.4);
z-index: 6000;
18、获取滚动条位置
onPageScroll: function(Object) {
console.log(Object.scrollTop)
},