button.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <div>
  3. <a :class="type">
  4. <span></span>
  5. <span></span>
  6. <span></span>
  7. <span></span>
  8. <slot></slot>
  9. </a>
  10. </div>
  11. </template>
  12. <script>
  13. export default {
  14. name: "JtButton",
  15. props: {
  16. type: {
  17. type: String,
  18. default: "primary",
  19. },
  20. },
  21. };
  22. </script>
  23. <style scoped>
  24. @import url("https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap");
  25. * {
  26. margin: 0;
  27. padding: 0;
  28. box-sizing: border-box;
  29. }
  30. a {
  31. position: relative;
  32. display: inline-block;
  33. padding: 25px 30px;
  34. margin: 40px 0;
  35. color: #03e9f4;
  36. text-decoration: none;
  37. text-transform: uppercase;
  38. transition: 0.5s;
  39. letter-spacing: 4px;
  40. overflow: hidden;
  41. margin-right: 50px;
  42. }
  43. a:hover {
  44. background: #03e9f4;
  45. color: #050801;
  46. box-shadow: 0 0 5px #03e9f4, 0 0 25px #03e9f4, 0 0 50px #03e9f4,
  47. 0 0 200px #03e9f4;
  48. -webkit-box-reflect: below 1px linear-gradient(transparent, #0005);
  49. }
  50. .warning {
  51. filter: hue-rotate(300deg);
  52. }
  53. .success {
  54. filter: hue-rotate(240deg);
  55. }
  56. a span {
  57. position: absolute;
  58. display: block;
  59. }
  60. a span:nth-child(1) {
  61. top: 0;
  62. left: 0;
  63. width: 100%;
  64. height: 2px;
  65. background: linear-gradient(90deg, transparent, #03e9f4);
  66. animation: animate1 1s linear infinite;
  67. }
  68. @keyframes animate1 {
  69. 0% {
  70. left: -100%;
  71. }
  72. 50%,
  73. 100% {
  74. left: 100%;
  75. }
  76. }
  77. a span:nth-child(2) {
  78. top: -100%;
  79. right: 0;
  80. width: 2px;
  81. height: 100%;
  82. background: linear-gradient(180deg, transparent, #03e9f4);
  83. animation: animate2 1s linear infinite;
  84. animation-delay: 0.25s;
  85. }
  86. @keyframes animate2 {
  87. 0% {
  88. top: -100%;
  89. }
  90. 50%,
  91. 100% {
  92. top: 100%;
  93. }
  94. }
  95. a span:nth-child(3) {
  96. bottom: 0;
  97. right: 0;
  98. width: 100%;
  99. height: 2px;
  100. background: linear-gradient(270deg, transparent, #03e9f4);
  101. animation: animate3 1s linear infinite;
  102. animation-delay: 0.5s;
  103. }
  104. @keyframes animate3 {
  105. 0% {
  106. right: -100%;
  107. }
  108. 50%,
  109. 100% {
  110. right: 100%;
  111. }
  112. }
  113. a span:nth-child(4) {
  114. bottom: -100%;
  115. left: 0;
  116. width: 2px;
  117. height: 100%;
  118. background: linear-gradient(360deg, transparent, #03e9f4);
  119. animation: animate4 1s linear infinite;
  120. animation-delay: 0.75s;
  121. }
  122. @keyframes animate4 {
  123. 0% {
  124. bottom: -100%;
  125. }
  126. 50%,
  127. 100% {
  128. bottom: 100%;
  129. }
  130. }
  131. </style>