Icon.vue 989 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <div class="icon" :title="title ? title : ''" @click="$emit('click')">
  3. <span>{{unicode}}</span>
  4. <ripple :color="ripple || ''"></ripple>
  5. </div>
  6. </template>
  7. <script>
  8. import Ripple from '@/components/Ripple'
  9. export default {
  10. components: { Ripple },
  11. props: ['unicode', 'title', 'ripple']
  12. }
  13. </script>
  14. <style lang="scss" scoped>
  15. @import '~@/style/theme.scss';
  16. .icon {
  17. position: relative;
  18. display: flex;
  19. align-items: center;
  20. justify-content: center;
  21. background: rgba(255, 255, 255, .8);
  22. padding: 8px;
  23. border-radius: 100px;
  24. min-width: 28px;
  25. min-height: 28px;
  26. width: 28px;
  27. height: 28px;
  28. user-select: none;
  29. cursor: pointer;
  30. text-align: center;
  31. font-family: 'iconfont', sans-serif;
  32. font-size: 0;
  33. color: $icon-normal-color;
  34. transition: all 0.2s;
  35. overflow: hidden;
  36. & > span {
  37. font-size: 24px;
  38. }
  39. &:hover {
  40. opacity: 0.8;
  41. background: white;
  42. }
  43. &:active {
  44. color: darken($icon-hover-color, 10);
  45. }
  46. }
  47. </style>