watch-button.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <view>
  3. <!-- 按钮 -->
  4. <button :class="['buttonBorder',!_rotate?'dlbutton':'dlbutton_loading']" :style="{'background':bgColor, 'color': fontColor}">
  5. <view :class="_rotate?'rotate_loop':''">
  6. <text v-if="_rotate" class="cuIcon cuIcon-loading1 "></text>
  7. <text v-if="!_rotate">{{ text }}</text>
  8. </view>
  9. </button>
  10. </view>
  11. </template>
  12. <script>
  13. export default{
  14. props:{
  15. text: String, //显示文本
  16. rotate:{
  17. //是否启动加载
  18. type: [Boolean,String],
  19. default: false,
  20. },
  21. bgColor:{
  22. //按钮背景颜色
  23. type: String,
  24. // default: "linear-gradient(to right, rgba(0,0,0,0.7), rgba(0,0,0,0.6))",
  25. },
  26. fontColor:{
  27. //按钮字体颜色
  28. type: String,
  29. default: "#000000",
  30. },
  31. },
  32. computed:{
  33. _rotate() {
  34. //处理值
  35. return String(this.rotate) !== 'false'
  36. },
  37. }
  38. }
  39. </script>
  40. <style>
  41. @import url("./css/icon.css");
  42. .dlbutton {
  43. /* color: #FFFFFF; */
  44. font-size: 30upx;
  45. width:601upx;
  46. height:90upx;
  47. /* background: #352680; */
  48. background: #FCD202;
  49. box-shadow:0upx 0upx 13upx 0upx rgba(164,217,228,0.4);
  50. border-radius:2.5rem;
  51. line-height: 90upx;
  52. text-align: center;
  53. margin-left: auto;
  54. margin-right: auto;
  55. margin-top: 96upx;
  56. }
  57. .dlbutton_loading {
  58. color: #FFFFFF;
  59. font-size: 30upx;
  60. width:100upx;
  61. height:100upx;
  62. background: #5E81F9;
  63. box-shadow:0upx 0upx 13upx 0upx rgba(164,217,228,0.4);
  64. border-radius:2.5rem;
  65. line-height: 100upx;
  66. text-align: center;
  67. margin-left: auto;
  68. margin-right: auto;
  69. margin-top: 96upx;
  70. }
  71. .buttonBorder{
  72. border: none ;
  73. border-radius: 2.5rem ;
  74. -webkit-box-shadow: 0 0 60upx 0 rgba(0,0,0,.2) ;
  75. box-shadow: 0 0 60upx 0 rgba(0,0,0,.2) ;
  76. -webkit-transition: all 0.4s cubic-bezier(.57,.19,.51,.95);
  77. -moz-transition: all 0.4s cubic-bezier(.57,.19,.51,.95);
  78. -ms-transition: all 0.4s cubic-bezier(.57,.19,.51,.95);
  79. -o-transition: all 0.4s cubic-bezier(.57,.19,.51,.95);
  80. transition: all 0.4s cubic-bezier(.57,.19,.51,.95);
  81. }
  82. /* 旋转动画 */
  83. .rotate_loop{
  84. -webkit-transition-property: -webkit-transform;
  85. -webkit-transition-duration: 1s;
  86. -moz-transition-property: -moz-transform;
  87. -moz-transition-duration: 1s;
  88. -webkit-animation: rotate 1s linear infinite;
  89. -moz-animation: rotate 1s linear infinite;
  90. -o-animation: rotate 1s linear infinite;
  91. animation: rotate 1s linear infinite;
  92. }
  93. @-webkit-keyframes rotate{from{-webkit-transform: rotate(0deg)}
  94. to{-webkit-transform: rotate(360deg)}
  95. }
  96. @-moz-keyframes rotate{from{-moz-transform: rotate(0deg)}
  97. to{-moz-transform: rotate(359deg)}
  98. }
  99. @-o-keyframes rotate{from{-o-transform: rotate(0deg)}
  100. to{-o-transform: rotate(359deg)}
  101. }
  102. @keyframes rotate{from{transform: rotate(0deg)}
  103. to{transform: rotate(359deg)}
  104. }
  105. </style>