普兆健康管家前端代码仓库
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.

49 lines
856 B

  1. <template>
  2. <view class="indicator flex">
  3. <view
  4. v-for="(item, index) in list"
  5. :key="index"
  6. :class="['indicator-dot', index === current ? 'is-active' : '']"
  7. @click="$emit('click', index)"
  8. ></view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. props: {
  14. current: {
  15. type: Number,
  16. default: 0,
  17. },
  18. length: {
  19. type: Number,
  20. default: 0,
  21. },
  22. },
  23. computed: {
  24. list() {
  25. return new Array(this.length).fill(0)
  26. }
  27. },
  28. }
  29. </script>
  30. <style scoped lang="scss">
  31. .indicator {
  32. &-dot {
  33. width: 12rpx;
  34. height: 12rpx;
  35. border-radius: 6rpx;
  36. background: #D9D9D9;
  37. & + & {
  38. margin-left: 12rpx;
  39. }
  40. &.is-active {
  41. width: 56rpx;
  42. background-image: linear-gradient(to right, #4B348F, #845CFA);
  43. }
  44. }
  45. }
  46. </style>