CusButton.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <template v-if="type === 'main'">
  3. <el-button type="primary">{{ title }}</el-button>
  4. </template>
  5. <template v-else-if="type === 'table-add'">
  6. <div class="cus-table-button __hover">
  7. <SvgIcon :name="icon || 'add'" size="12" color="var(--cus-main-color)"/>{{ title || '新增' }}
  8. </div>
  9. </template>
  10. <template v-else-if="type === 'table'">
  11. <div class="cus-table-button __hover">
  12. <SvgIcon :name="icon" size="12" color="var(--cus-main-color)"/>{{ title }}
  13. </div>
  14. </template>
  15. <template v-else-if="type === 'table-edit'">
  16. <div class="cus-table-button __hover">
  17. <SvgIcon :name="icon || 'edit'" size="12" color="#4996FF"/>{{ title || '编辑' }}
  18. </div>
  19. </template>
  20. <template v-else-if="type === 'table-del'">
  21. <div class="cus-table-button table-del __hover">
  22. <SvgIcon :name="icon || 'del'" size="12" color="#f56c6c"/>{{ title || '删除' }}
  23. </div>
  24. </template>
  25. <template v-else-if="type === 'add'">
  26. <div class="cus-button add __hover">
  27. {{ title || '新增' }}
  28. </div>
  29. </template>
  30. <template v-else>
  31. <div class="cus-button __hover">
  32. {{ title }}
  33. </div>
  34. </template>
  35. </template>
  36. <script setup lang="ts">
  37. defineOptions({
  38. name: 'CusButton',
  39. });
  40. import {getCurrentInstance, reactive} from "vue";
  41. const {proxy} = getCurrentInstance()
  42. const props = defineProps({
  43. type: {},
  44. title: {},
  45. icon: {}
  46. })
  47. const state: any = reactive({})
  48. </script>
  49. <style lang="scss" scoped>
  50. .el-button {
  51. &.el-button--primary:hover {
  52. background-color: rgba(var(--cus-main-color-rgb), 0.7);
  53. border-color: rgba(var(--cus-main-color-rgb), 0.7);
  54. }
  55. }
  56. .cus-table-button {
  57. height: 24px;
  58. display: inline-flex;
  59. align-items: center;
  60. border-radius: 2px;
  61. border: 1px solid #4996FF;
  62. padding: 0 8px;
  63. gap: 4px;
  64. font-weight: 400;
  65. font-size: 14px;
  66. color: #4996FF;
  67. &.table-del {
  68. border-color: #f56c6c;
  69. color: #f56c6c;
  70. }
  71. }
  72. .cus-button {
  73. height: 40px;
  74. padding: 0 16px;
  75. border-radius: 4px;
  76. background: #6DA3EF;
  77. display: flex;
  78. align-items: center;
  79. justify-content: center;
  80. font-weight: 400;
  81. font-size: 16px;
  82. color: #FFFFFF;
  83. &.add {
  84. background-color: #2FBCCD;
  85. }
  86. }
  87. </style>