触底生命周期onReachBottom
下拉刷新生命周期onPullDownRefresh
加载圈圈wx.showLoading(); / wx.hideLoading();
点击事件bindtap
客服 open-type = "contact"
页面跳转 wx.navigateTo({ url: '/packageOrder/pages/orderDesc/orderDesc'})
阻止冒泡 catchtap="onClick"
转义字符使用
<text decode='true'><上海出发></text>
// 底部导航tabBar app.json
"tabBar": {
"selectedColor": "#ea5149",
"list": [
{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "images/img/book.png",
"selectedIconPath": "images/img/book-active.png"
},
{
"pagePath": "pages/me/me",
"text": "我",
"iconPath": "images/img/me.png",
"selectedIconPath": "images/img/me-active.png"
}
]
},
____________
//获取用户信息getUserInfo
<button size="mini" bindgetuserinfo="onGetUserInfo" open-type="getUserInfo">登录</button>
//获取用户信息
onGetUserInfo(e) {
let userInfo = e.detail.userInfo
// 需要调用云函数,获取用户的openid
wx.cloud.callFunction({
name:'login',
complete: res=>{
userInfo.openid = res.result.openid
this.setData({
userInfo
})
// 写入本地缓存
wx.setStorageSync("userInfo", userInfo)
}
})
},
//读取缓存 getStorageSync
data: {
userInfo: wx.getStorageSync("userInfo") || {},
},
____________
//调起客户端扫码界面进行扫码wx.scanCode
bindtap = "scanCode"
scanCode() {
wx.scanCode({
success: res=>{
//图书的isbn号 去豆瓣获取详情
this.addBook(res.result)
}
})
},
_____________
//数据库添加数据db.collection('name').add
const db = wx.cloud.database()
db.collection('doubanbooks').add({
data: result
})
_____________
//下拉刷新 json文件中配置
"enablePullDownRefresh": true,
wx:for / wx:if / bindtap /
<view class="card" wx:for="{{item.arr}}" wx:for-item="litem" wx:for-index="lindex">
______________________
<view class="list-wrap" wx:for="{{dateArr}}" wx:key="index">
________________________
<image bindtap="showEye" wx:if="{{iseye}}" class="eye" src="/packageHome/images/calendar/open.png"></image>
<image wx:else class="eye" bindtap="showEye" src="/packageHome/images/calendar/close.png"></image>
弹出层禁止页面滚动catchtouchmove='true'
<view class="graph-modal" wx:if="{{isGraph}}" catchtouchmove='true'>
<view class="modal">
<image show-menu-by-longpress="true" class="shareImg" src="{{shareImg}}"></image>
</view>
<view class="close-wrap" bindtap="closeModal">
<image class="close" src="/packageHome/images/goodDetails/close.png"></image>
</view>
</view>
网友评论