toolTipBtn.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <div class="tool-tip-btn">
  3. <el-tooltip
  4. effect="dark"
  5. :content="content"
  6. placement="bottom"
  7. :disabled="disabled"
  8. >
  9. <div
  10. class="icon-btn"
  11. @click="clickHandler"
  12. :class="{ 'disabled-status': disabled }"
  13. >
  14. <svg-icon
  15. :name="name"
  16. :color="disabled ? '#bfbfbf' : '#595959'"
  17. ></svg-icon>
  18. </div>
  19. </el-tooltip>
  20. </div>
  21. </template>
  22. <script>
  23. export default {
  24. name: "ToolTipBtn",
  25. props: {
  26. content: {
  27. type: String,
  28. default: "",
  29. },
  30. name: {
  31. type: String,
  32. require: true,
  33. },
  34. disabled: {
  35. type: Boolean,
  36. default: false,
  37. },
  38. },
  39. methods: {
  40. clickHandler() {
  41. !this.disabled && this.$emit("click");
  42. },
  43. },
  44. };
  45. </script>
  46. <style lang="scss" scoped>
  47. .tool-tip-btn {
  48. display: inline-block;
  49. &:not(:first-child) {
  50. margin-left: 12px;
  51. }
  52. .icon-btn {
  53. width: 32px;
  54. height: 32px;
  55. border-radius: 6px;
  56. border: 1px solid #e5e5e5;
  57. display: flex;
  58. justify-content: center;
  59. align-items: center;
  60. cursor: pointer;
  61. transition: all 0.3s;
  62. &:not(.disabled-status):hover {
  63. background-color: #f0f0f0;
  64. }
  65. &.disabled-status {
  66. cursor: not-allowed;
  67. }
  68. }
  69. }
  70. </style>