power-change-header.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <view class="header">
  3. <navigator url="/pages/monitoring/index" open-type="redirect" :class="{'active':currentPage===1}">换电流程
  4. </navigator>
  5. <navigator url="/pages/carinfo/index" open-type="redirect" :class="{'active':currentPage===2}">车辆信息</navigator>
  6. <navigator url="/pages/batteryinfo/index" open-type="redirect" :class="{'active':currentPage===3}">电池信息
  7. </navigator>
  8. </view>
  9. </template>
  10. <script>
  11. export default {
  12. name: "power-change-header",
  13. data() {
  14. return {
  15. currentPage: 0,
  16. };
  17. },
  18. mounted() {
  19. this.getRoute()
  20. },
  21. methods: {
  22. getRoute() {
  23. let curPage = getCurrentPages();
  24. let route = curPage[curPage.length - 1].route
  25. if (route === 'pages/monitoring/index') {
  26. this.currentPage = 1
  27. } else if (route === 'pages/carinfo/index') {
  28. this.currentPage = 2
  29. } else if (route === 'pages/batteryinfo/index') {
  30. this.currentPage = 3
  31. }
  32. }
  33. }
  34. }
  35. </script>
  36. <style lang="scss" scoped>
  37. .header {
  38. display: flex;
  39. padding: 30rpx;
  40. width: 690rpx;
  41. color: #86909c;
  42. font-size: 32rpx;
  43. justify-content: space-around;
  44. .active {
  45. color: #1d2129;
  46. font-weight: bold;
  47. position: relative;
  48. }
  49. .active::after {
  50. content: '';
  51. background-image: url('@/static/line.png');
  52. background-size: 100% 100%;
  53. width: 52rpx;
  54. height: 9rpx;
  55. position: absolute;
  56. bottom: -25rpx;
  57. left: 32%;
  58. }
  59. }
  60. </style>