小程式事件
阿新 • • 發佈:2020-08-26
catchtap :點選不會冒泡
bindtap : 點選冒泡
data-ndnumType : 傳遞引數
e.currentTarget.dataset : 獲取引數
<view class="tab_item" bindtap='toMyNode' data-current="1"> <view class="tab_item_top"> {{nodeOver}} </view> <view class="tab_item_bottom">已逾期</view> </view>
toMyNode: function(e){var id = e.currentTarget.dataset.current wx.navigateTo({ url: '../myNode/myNode?id='+id }) }, wx.setStorageSync('index_node_refresh', true) : 本地儲存 wx.getStorageSync('index_node_refresh') : 獲取本地儲存 wx.reLaunch({ url: '/pages/login/login' }) 退出登入 wx.redirectTo({ //同級頁面跳轉 url: '/pages/index/index' }) wx.switchTab({ url:'/pages/index/index' }) 跳轉到 tabBar 頁面,並關閉其他所有非 tabBar 頁面
// 獲取滾動條當前位置--固定導航欄 <view class="task-table" id="task-table-box"> <view class="top flex {{fixedNav ? 'fixed-nav' : ''}}"> </view> </view> onPageScroll:function(e){ // 獲取滾動條當前位置 wx.createSelectorQuery().select('#task-table-box').boundingClientRect( (rect) => {// console.log('rect',rect) if (rect.top <= 0) { //臨界值,根據自己的需求來調整 this.setData({ fixedNav: true //是否固定導航欄 }) } else { this.setData({ fixedNav: false }) } }).exec() },