index.vue 765 B

123456789101112131415161718192021222324252627282930313233
  1. <template>
  2. <span
  3. class="btn-back"
  4. @click="goBackHandler"
  5. ><i class="el-icon-arrow-left" />返回上一步</span>
  6. </template>
  7. <script>
  8. export default {
  9. methods: {
  10. goBackHandler() {
  11. const pathArray = this.$route.path.split('/')
  12. if (pathArray[1] === 'advance') {
  13. this.$router.push('/advance')
  14. } else if (pathArray.at(-1) === 'flightView') {
  15. this.$router.push(`/${pathArray[1]}`)
  16. } else if (['baggageView', 'containerView'].includes(pathArray.at(-1))) {
  17. this.$router.push(`${pathArray.slice(0, -1).join('/')}/flightView`)
  18. }
  19. }
  20. }
  21. }
  22. </script>
  23. <style lang="scss" scoped>
  24. .btn-back {
  25. margin-left: 24px;
  26. font-size: 16px;
  27. font-weight: normal;
  28. color: #2d67e3;
  29. cursor: pointer;
  30. }
  31. </style>