navi.ts 618 B

123456789101112131415161718192021222324252627282930313233
  1. export function navigateTo(object: navigateTo.Option) {
  2. if (getCurrentPages().length > 9) {
  3. redirectTo(object as redirectTo.Option)
  4. } else {
  5. wx.navigateTo(object)
  6. }
  7. }
  8. export function navigateBack(object: navigateBack.Option) {
  9. wx.navigateBack(object)
  10. }
  11. export function switchTab(object: switchTab.Option) {
  12. wx.switchTab(object)
  13. }
  14. export function redirectTo(object: redirectTo.Option) {
  15. wx.redirectTo(object)
  16. }
  17. export function reLaunch(object: reLaunch.Option) {
  18. wx.reLaunch(object)
  19. }
  20. const Navi = {
  21. navigateTo,
  22. navigateBack,
  23. switchTab,
  24. redirectTo,
  25. reLaunch,
  26. }
  27. export default Navi