slider.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <div class="slider-box">
  3. <div v-for="(item, index) in list" :key="index" class="slider-box-item" @click="handleClick(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. const list = [
  20. { mdi: 'mdi-arrow-up-bold', tips: '返回顶部' },
  21. { mdi: 'mdi-qrcode', tips: '微信公众号', showImg: 'https://minio.citupro.com/dev/static/mendunerCode.jpg' },
  22. { mdi: 'mdi-face-agent', tips: '客服' },
  23. { mdi: 'mdi-list-box-outline', tips: '在线简历' }
  24. ]
  25. const handleClick = (index) => {
  26. // 回到顶部
  27. if (index === 0) window.scrollTo({ top: 0, behavior: 'smooth' })
  28. }
  29. </script>
  30. <style lang="scss" scoped>
  31. .slider-box {
  32. width: 44px;
  33. height: 180px;
  34. background-color: #fff;
  35. border-radius: 22px;
  36. box-shadow: 0 4px 20px 0 rgba(0,0,0,.06);
  37. }
  38. .slider-box-item {
  39. width: 44px;
  40. height: 44px;
  41. padding: 6px 0;
  42. text-align: center;
  43. }
  44. .icons {
  45. color: #ccc;
  46. &:hover {
  47. color: var(--v-primary-base);
  48. }
  49. }
  50. .tip-text {
  51. font-size: 14px;
  52. color: #222;
  53. }
  54. </style>