hover-tip.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <div class="hover-tip">
  3. <img :src="icon" alt="" />
  4. <span>{{ txt }}</span>
  5. <img :src="require('@/assets/svg/icon-tip-arrow.svg')" alt="" class="arrow" />
  6. </div>
  7. </template>
  8. <script setup>
  9. import { defineProps } from 'vue'
  10. defineProps({
  11. txt: {
  12. type: String,
  13. default: ''
  14. },
  15. icon: {
  16. type: String,
  17. default: require('@/assets/svg/icon-green-yes.svg')
  18. }
  19. })
  20. </script>
  21. <style lang="scss">
  22. .hover-tip {
  23. width: fit-content;
  24. height: 20px;
  25. line-height: 20px;
  26. padding: 0 7px;
  27. background: rgba(0, 0, 0, 0.6);
  28. border-radius: 3px;
  29. display: flex;
  30. align-items: center;
  31. position: relative;
  32. margin-bottom: 5px;
  33. position: absolute;
  34. top: -20px;
  35. img {
  36. width: 12px;
  37. height: 12px;
  38. }
  39. span {
  40. margin-left: 4px;
  41. font-weight: 500;
  42. font-size: 12px;
  43. color: #FFFFFF;
  44. }
  45. .arrow {
  46. position: absolute;
  47. width: 9px;
  48. height: 5px;
  49. bottom: -5px;
  50. left: 50%;
  51. margin-left: -4.5px;
  52. }
  53. }
  54. </style>