小程序中的常用坑:https://www.jianshu.com/p/10cb1eb890ca
参考文章:https://blog.youkuaiyun.com/user_3011/article/details/80551809
https://developer.mozilla.org/zh-CN/docs/Web/CSS/object-fit
1. 用flex布局时不能用text-align属性
2. wxs中不能用定时器
3. 在wxml里面可以直接通过{
{idnex}}
取得当前正被遍历的索引值
4. catchfocu=""
:获取焦点事件
5. bindblur=""
:失去焦点事件
6. 去掉<scroll-view>
标签的滚动轴:
::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
}
7. 写transition:translate()时:① wxss文件中正常使用rpx单位 ② wxml中的style属性 必须在前面加空格 比如view>
8. 在用<scroll-view></scroll-view>
时,必须要给该标签设置高/宽(如果横轴滚动,则要设置宽,如果纵轴滚动,需要设置高)
9. picker
和input
的标签的禁用都是disabled="true"
10. 在wxml
中属性和字符串拼接和js
中写法相同
11. 最新获取用户头像和昵称的方法(直接添加到wxml里面即可):
① 头像:<open-data type="userAvatarUrl"></opendata>
② 昵称:<open-data type="userNickName" lang="zh_CN"></open-data>
12. 几种弹窗提示:
① wx.showModal({})
:带确定与取消的弹窗
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var that = this
wx.<