You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.2 KiB

2 years ago
  1. <template>
  2. <div class="tw-sticky tw-top-[172px]">
  3. <div :class="['tw-w-full tw-flex tw-flex-col']">
  4. <template v-for="(item, index) in fixBarList">
  5. <a :key="index" v-if="item.show" :class="[
  6. 'crollactive-item xl:tw-mb-[34px] tw-body-2 tw-text-base-tertiary hover:tw-text-primary-default tw-transition-all tw-ease-in-out',
  7. step == item.id
  8. ? 'active tw-text-black tw-font-bold title-icon-left'
  9. : 'tw-text-base-tertiary',
  10. ]" href="#" v-scroll-to="{
  11. el: `#${item.id}`,
  12. offset: -150,
  13. }" @click="activeStep(item.id)">{{ $t(item.title) }}</a></template>
  14. </div>
  15. </div>
  16. </template>
  17. <script>
  18. export default {
  19. props: {
  20. fixBarList: {
  21. type: Array,
  22. },
  23. currStep: {
  24. type: String,
  25. },
  26. },
  27. data() {
  28. return {
  29. step: '',
  30. click: false,
  31. }
  32. },
  33. watch: {
  34. currStep: {
  35. handler: function () {
  36. if (!this.click) {
  37. this.step = this.currStep;
  38. }
  39. }
  40. }
  41. },
  42. methods: {
  43. activeStep(id) {
  44. this.click = true;
  45. this.step = id;
  46. setTimeout(() => {
  47. this.click = false;
  48. }, 300)
  49. }
  50. }
  51. };
  52. </script>
  53. <style lang="scss" scoped>
  54. </style>