1、swiper 点击,class不能使用原生名字,去掉round-dot才能去掉点
2、转发
3、下拉刷新
json:"enablePullDownRefresh": true
要及时关闭刷新等待 wx.stopPullDownRefresh()
4、获取用户头像:
<open-data type="userAvatarUrl"></open-data>
获取用户昵称:
<open-data type="userNickName"></open-data>
5、不同标签获取的参数不同
view data-item: event.currentTarget.dataset.item
image data-item: event.target.dataset.item
6 https://www.jianshu.com/p/928932e74958
// 获取用户openid
getOpenid: function () {
let that = this;
//获取openid不需要授权
wx.login({
success: function (res) {
//请求自己后台获取用户openid
wx.request({
url: 'https://30paotui.com/user/wechat',
data: {
appid: 'wx64eb9e2828c2b180',
secret: '3f54c3833f64330ce86b6742ec8b1e21',
code: res.code
},
success: function (response) {
var openid = response.data.openid;
console.log('请求获取openid:' + openid);
//可以把openid存到本地,方便以后调用
wx.setStorageSync('openid', openid);
that.setData({
openid: "获取到的openid:" + openid
})
}
})
}
})
}
小程序hidden不生效问题
hidden类似wx:if,经常使用。后来发现有些时候hidden不管用,检查代码,hidden属性在。就是没有隐藏。
反复测试后发现,用flex定位的hidden都不管用。这个坑记录一下。
confirm-type 的五种值与真机效果
1、完成(默认)
confirm-type="done"
2、开始
confirm-type="go"
3、搜索
confirm-type="search"
4、发送
confirm-type="send"
5、下一步
confirm-type="next"
根据业务的情景选择最合适的confirm-type吧