鸿宇研学生前端代码
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.

72 lines
1.4 KiB

  1. <template>
  2. <view class="swiper">
  3. <uv-swiper
  4. :list="bannerList" keyName="image"
  5. indicator
  6. indicatorMode="dot"
  7. indicatorInactiveColor="rgba(255, 255, 255, 0.7)"
  8. height="228rpx"
  9. @click="onClickBanner"
  10. ></uv-swiper>
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. data() {
  16. return {
  17. bannerList: [],
  18. }
  19. },
  20. created() {
  21. this.getData()
  22. },
  23. methods: {
  24. getData() {
  25. // todo: fetch
  26. this.bannerList = [
  27. {
  28. image: '/static/image/temp-14.png',
  29. },
  30. {
  31. image: '/static/image/temp-14.png',
  32. },
  33. {
  34. image: '/static/image/temp-14.png',
  35. },
  36. {
  37. image: '/static/image/temp-14.png',
  38. },
  39. {
  40. image: '/static/image/temp-14.png',
  41. },
  42. {
  43. image: '/static/image/temp-14.png',
  44. },
  45. ]
  46. },
  47. onClickBanner(index) {
  48. console.log('onClickBanner', index)
  49. },
  50. },
  51. }
  52. </script>
  53. <style scoped lang="scss">
  54. .swiper {
  55. border-radius: 32rpx;
  56. overflow: hidden;
  57. /deep/ .uv-swiper-indicator__wrapper__dot,
  58. /deep/ .uv-swiper-indicator__wrapper__dot--active {
  59. margin: 0 4rpx;
  60. width: 30rpx;
  61. height: 10rpx;
  62. }
  63. /deep/ .uv-swiper-indicator__wrapper__dot--active {
  64. background: linear-gradient(to right, #21FEEC 40%, #019AF9);
  65. }
  66. }
  67. </style>