To solve the problem, set the global variable flag, encapsulate the jump function, and set the timer to not allow repeated jumps for a few seconds.
1: If using uni.navigateTo jump
jumpFlag: function(path) { //Jump switch
if (getApp().globalData.is_flag) { //is_flag starts to equal true
getApp().globalData.is_flag = false;
uni.navigateTo({ url: path, }) ; setTimeout(() => { getApp().globalData.is_flag = true; console.log(getApp().globalData.is_flag); }, 1000) } else { console.log('Repeated click'); } },
is_flag is defined in app.vue
export default { globalData: { is_flag:true //Jump switch
}
}
2: If the tab bar at the bottom of the page switches tabs, an error occurs.
Monitor the onTabItemTap life cycle on the page, use plus.nativeObj.view to place a block to cover the clicked tab, and add a delay to cancel the block of plus.nativeObj.view in the same way as above.
For technical discussions, please add qq445849201