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

53 lines
1.1 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. async getData() {
  25. try {
  26. this.bannerList = (await this.$fetch('queryBannerList', { type: 1 })).records // type:0-首页顶部 1-首页中部
  27. } catch (err) {
  28. }
  29. },
  30. onClickBanner(index) {
  31. console.log('onClickBanner', index)
  32. },
  33. },
  34. }
  35. </script>
  36. <style scoped lang="scss">
  37. .swiper {
  38. border-radius: 32rpx;
  39. overflow: hidden;
  40. /deep/ .uv-swiper-indicator__wrapper__dot,
  41. /deep/ .uv-swiper-indicator__wrapper__dot--active {
  42. margin: 0 4rpx;
  43. width: 30rpx;
  44. height: 10rpx;
  45. }
  46. /deep/ .uv-swiper-indicator__wrapper__dot--active {
  47. background: linear-gradient(to right, #21FEEC 40%, #019AF9);
  48. }
  49. }
  50. </style>