slider.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <div class="slider-box">
  3. <div v-for="(item, index) in list" :key="index" class="slider-box-item" @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-list-box-outline', tips: '在线简历', path: '/recruit/personal/resume' }
  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. height: 180px;
  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. padding: 6px 0;
  45. text-align: center;
  46. }
  47. .icons {
  48. color: var(--color-ccc);
  49. &:hover {
  50. color: var(--v-primary-base);
  51. }
  52. }
  53. .tip-text {
  54. font-size: 14px;
  55. color: var(--color-222);
  56. }
  57. </style>