useGoback.js 258 B

1234567891011121314151617
  1. const canNavBack = getCurrentPages()
  2. export function useGoBack() {
  3. /**
  4. * 返回
  5. */
  6. const goBack = () => {
  7. if( canNavBack && canNavBack.length>1) {
  8. uni.navigateBack()
  9. } else {
  10. history.back();
  11. }
  12. }
  13. return {
  14. goBack
  15. }
  16. }