util.js 368 B

123456789101112131415
  1. const app = getApp();
  2. function tabberFunc (active, path) {
  3. if (active) return false;
  4. const routes = getCurrentPages();
  5. let _index = 0;
  6. routes.forEach((item, index) =>
  7. item.route == path ? _index = routes.length - index - 1 : '');
  8. _index > 0 ? wx.navigateBack({ delta: _index }) : wx.navigateTo({ url: "/" + path })
  9. }
  10. module.exports = {
  11. tabberFunc
  12. }