- 居中显示
display:flex;
justify-content:center;
align-items: center;
- 解决view嵌套margin属性不起作用
overflow: hidden;
- 关于height:100%和height:100vh的区别
vh就是当前屏幕可见高度的1%,也就是说
height:100vh == height:100%;
但是当元素没有内容时候,设置height:100%,该元素不会被撑开,此时高度为0,
但是设置height:100vh,该元素会被撑开屏幕高度一致。
- 背景图片不适配添加background-size属性
background-image: url(…/…/static/bg.png);
background-size: 100% 100%;
- 小程序动态设置 tabBar 某一项的内容
wx.setTabBarItem({
index: 0,
text: ‘text’,
iconPath: ‘/path/to/iconPath’,
selectedIconPath: ‘/path/to/selectedIconPath’
})
- 小程序button文字居中添加line-height属性
- 延时操作
setTimeout(function () {
console.log(‘123’)
}, 2000)