slider.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <div class="slider-box">
  3. <div v-for="(item, index) in list" :key="index" class="slider-box-item" :class="{'mt-3': !index}" @click="handleClick(item, index)">
  4. <v-btn size="30" class="icons" icon variant="text">
  5. <v-icon class="icons" size="30">{{ item.mdi }}</v-icon>
  6. <v-tooltip :text="item.tips" location="start" activator="parent">
  7. <div v-if="item.showImg" class="ma-3" style="text-align: center">
  8. <v-img cover aspect-ratio="1/1" src="https://minio.citupro.com/dev/static/mendunerCode.jpg" :width="170" style="height: 170px;"></v-img>
  9. <span class="tips-text">关注门墩儿微信公众号</span>
  10. </div>
  11. <span v-else>{{ item.tips }}</span>
  12. </v-tooltip>
  13. </v-btn>
  14. </div>
  15. </div>
  16. </template>
  17. <script setup>
  18. defineOptions({ name: 'personalSlider' })
  19. import { useRouter } from 'vue-router'
  20. const router = useRouter()
  21. const list = [
  22. // { mdi: 'mdi-arrow-up-bold', tips: '返回顶部' },
  23. { mdi: 'mdi-qrcode', tips: '微信公众号', showImg: 'https://minio.citupro.com/dev/static/mendunerCode.jpg' },
  24. { mdi: 'mdi-face-agent', tips: '客服' },
  25. { mdi: 'mdi-application-settings', tips: '预约演示', path: '/' }
  26. ]
  27. const handleClick = (item, index) => {
  28. // 回到顶部
  29. if (index === 0) window.scrollTo({ top: 0, behavior: 'smooth' })
  30. if (item.path) router.push(item.path)
  31. }
  32. </script>
  33. <style lang="scss" scoped>
  34. .slider-box {
  35. width: 44px;
  36. padding: 20px 0;
  37. background-color: #fff;
  38. border-radius: 22px;
  39. box-shadow: 0 4px 20px 0 rgba(0,0,0,.06);
  40. }
  41. .slider-box-item {
  42. width: 44px;
  43. height: 44px;
  44. text-align: center;
  45. }
  46. .icons {
  47. color: var(--color-ccc);
  48. &:hover {
  49. color: var(--v-primary-base);
  50. }
  51. }
  52. .tip-text {
  53. font-size: 14px;
  54. color: var(--color-222);
  55. }
  56. </style>