button.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <view>
  3. <cu-custom bgColor="bg-gradual-blue" :isBack="true"><block slot="backText">返回</block><block slot="content">按钮</block></cu-custom>
  4. <view class="cu-bar bg-white solid-bottom">
  5. <view class="action">
  6. <text class="cuIcon-title text-blue"></text>按钮形状
  7. </view>
  8. <view class="action">
  9. <navigator class="action" url="design" hover-class="none">
  10. <text class="cuIcon-skinfill"></text>
  11. <text class="text-df">设计</text>
  12. </navigator>
  13. </view>
  14. </view>
  15. <view class="padding flex flex-wrap justify-between align-center bg-white">
  16. <button class="cu-btn">默认</button>
  17. <button class="cu-btn round">圆角</button>
  18. <button class="cu-btn cuIcon">
  19. <text class="cuIcon-emojifill"></text>
  20. </button>
  21. </view>
  22. <view class="cu-bar margin-top bg-white solid-bottom">
  23. <view class="action">
  24. <text class="cuIcon-title text-blue"></text>按钮尺寸
  25. </view>
  26. </view>
  27. <view class="padding flex flex-wrap justify-between align-center bg-white">
  28. <button class="cu-btn round sm">小尺寸</button>
  29. <button class="cu-btn round">默认</button>
  30. <button class="cu-btn round lg">大尺寸</button>
  31. </view>
  32. <view class="cu-bar margin-top bg-white">
  33. <view class="action">
  34. <text class="cuIcon-title text-blue"></text>按钮颜色
  35. </view>
  36. <view class="action">
  37. <text class="text-df margin-right-sm">阴影</text>
  38. <switch @change="SetShadow" :class="shadow?'checked':''" color="#39B54A"></switch>
  39. </view>
  40. </view>
  41. <view class="grid col-5 padding-sm">
  42. <view class="margin-tb-sm text-center" v-for="(item,index) in ColorList" :key="index">
  43. <button class="cu-btn round" :class="['bg-' + item.name , shadow?'shadow':'']">{{item.title}}</button>
  44. </view>
  45. </view>
  46. <view class="cu-bar margin-top bg-white">
  47. <view class="action">
  48. <text class="cuIcon-title text-blue"></text>镂空按钮
  49. </view>
  50. <view class="action">
  51. <radio-group @change="SetBorderSize">
  52. <label class="margin-left-sm">
  53. <radio class="blue radio" value="" checked></radio>
  54. <text class="margin-left-sm">小</text>
  55. </label>
  56. <label class="margin-left-sm">
  57. <radio class="blue radio" value="s"></radio>
  58. <text class="margin-left-sm">大</text>
  59. </label>
  60. </radio-group>
  61. </view>
  62. </view>
  63. <view class="grid col-5 padding-sm">
  64. <view class="margin-tb-sm text-center" v-for="(item,index) in ColorList" :key="index" v-if="item.name!='white'">
  65. <button class="cu-btn round" :class="[bordersize?'lines-' + item.name:'line-' + item.name, shadow?'shadow':'']">{{item.title}}</button>
  66. </view>
  67. </view>
  68. <view class="cu-bar margin-top bg-white">
  69. <view class="action">
  70. <text class="cuIcon-title text-blue"></text>块状按钮
  71. </view>
  72. </view>
  73. <view class="padding flex flex-direction">
  74. <button class="cu-btn bg-grey lg">玄灰</button>
  75. <button class="cu-btn bg-red margin-tb-sm lg">嫣红</button>
  76. </view>
  77. <view class="cu-bar margin-top bg-white">
  78. <view class="action">
  79. <text class="cuIcon-title text-blue"></text>无效状态
  80. </view>
  81. </view>
  82. <view class="padding">
  83. <button class="cu-btn block bg-blue margin-tb-sm lg" disabled type="">无效状态</button>
  84. <button class="cu-btn block line-blue margin-tb-sm lg" disabled>无效状态</button>
  85. </view>
  86. <view class="cu-bar margin-top bg-white">
  87. <view class="action">
  88. <text class="cuIcon-title text-blue"></text>按钮加图标
  89. </view>
  90. </view>
  91. <view class="padding-xl">
  92. <button class="cu-btn block line-orange lg">
  93. <text class="cuIcon-upload"></text> 图标</button>
  94. <button class="cu-btn block bg-blue margin-tb-sm lg">
  95. <text class="cuIcon-loading2 cuIconfont-spin"></text> 加载</button>
  96. <button class="cu-btn block bg-black margin-tb-sm lg" loading> 原生加载</button>
  97. </view>
  98. </view>
  99. </template>
  100. <script>
  101. export default {
  102. data() {
  103. return {
  104. ColorList: this.ColorList,
  105. shadow: false,
  106. bordersize: ''
  107. };
  108. },
  109. methods: {
  110. SetShadow(e) {
  111. this.shadow = e.detail.value
  112. },
  113. SetBorderSize(e) {
  114. this.bordersize = e.detail.value
  115. }
  116. }
  117. }
  118. </script>
  119. <style>
  120. </style>