• 按钮组件草稿


    1. <template>
    2. <div class="zj-button">
    3. <div class="button-box">
    4. <button><a class="a">这个a>button>
    5. div>
    6. div>
    7. template>
    8. <script>
    9. export default {
    10. name: 'zj-button',
    11. data() {
    12. return {
    13. };
    14. },
    15. }
    16. script>
    17. <style>
    18. .zj-button {
    19. width: 100%;
    20. height: 100%;
    21. }
    22. .zj-button .button-box {
    23. position: relative;
    24. height: 100%;
    25. width: 100%;
    26. }
    27. .zj-button .button-box button {
    28. position: absolute;
    29. top: 0;
    30. left: 0;
    31. height: 100%;
    32. width: 100%;
    33. border: 0;
    34. border-radius: 10px;
    35. background-color: #182848;
    36. z-index: 100;
    37. }
    38. .zj-button .button-box button a {
    39. text-decoration: none;
    40. color: #fff;
    41. background: linear-gradient(-45deg, #ff00c1, #00fff9);
    42. /* 背景只有文字有 除了文字 其他都被裁剪掉 */
    43. -webkit-background-clip: text;
    44. /* 表示文字颜色填充 */
    45. -webkit-text-fill-color: transparent;
    46. }
    47. .zj-button .button-box .button::after, .button-box::before {
    48. content: "";
    49. width: 110%;
    50. height: 110%;
    51. border-radius: 10px;
    52. box-sizing: border-box;
    53. position: absolute;
    54. left: -5%; top: -5%;
    55. /* var(--rotate) 一个变量 变量名为--rotate*/
    56. background: linear-gradient(var(--rotate),#FF00c1 0%, #9600ff 25%, #4900ff 50%, #00b8ff 80%, #00fff9 100%);
    57. z-index: 1;
    58. }
    59. .button-box:hover::after, .button-box:hover::before {
    60. /* 给变量重新赋值 */
    61. --rotate: 3600deg;
    62. /* 过渡 */
    63. transition: --rotate 20s linear;
    64. }
    65. .button-box:hover::before {
    66. /* 动画的执行 */
    67. animation: fade 1.2s;
    68. }
    69. /* 定义一个变量 --rotate 值为130deg 类型为 不继承 */
    70. @property --rotate { initial-value: 130deg; syntax: ''; inherits: false; }
    71. /* 定义动画 */
    72. @keyframes fade {
    73. 0% {
    74. /* 透明度为1 */
    75. opacity: 1;
    76. transform: scale(1);
    77. filter: blur(10px)
    78. }
    79. 100% {
    80. /* 透明度为0 */
    81. opacity: 0;
    82. /* 等比例缩放 放大1.2倍 */
    83. transform: scale(1.2);
    84. /* 模糊程度 */
    85. filter: blur(10px)
    86. }
    87. }

  • 相关阅读:
    C#/VB.NET 在Excel单元格中应用多种字体格式
    多线程处理大批量数据操作
    服务器(I/O)之多路转接
    SQL语句学习+牛客基础39SQL
    2022年最新辽宁建筑安全员模拟题库及答案
    java-junit单元测试
    如何正确的防止服务器被攻击?103.216.153.x
    Wpf 使用 Prism 实战开发Day02
    JavaScript保姆级教程 ——— 重难点详细解析(万字长文,建议收藏)
    uniapp树形层级选择器
  • 原文地址:https://blog.csdn.net/qq_52421092/article/details/126231015