You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

button.vue 3.5 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <view>
  3. <l-title>按钮类型:</l-title>
  4. <view class="padding bg-white">
  5. <view class="flex flex-wrap justify-around">
  6. <l-button>默认</l-button>
  7. <l-button round>圆角 (round)</l-button>
  8. <l-button round>
  9. <l-icon type="likefill" class="margin-right-xs" />
  10. 图标
  11. </l-button>
  12. </view>
  13. </view>
  14. <l-demo-description>按钮使用 l-button 标签,添加 round 属性即为圆角</l-demo-description>
  15. <l-title>禁用按钮:</l-title>
  16. <view class="padding bg-white">
  17. <view class="flex flex-wrap justify-around margin-top-sm">
  18. <l-button color="red" disabled>禁用按钮 (disabled)</l-button>
  19. <l-button color="red" disabled round>禁用圆角按钮</l-button>
  20. </view>
  21. </view>
  22. <l-demo-description>添加 disabled 属性即可禁用按钮</l-demo-description>
  23. <l-title>按钮尺寸:</l-title>
  24. <view class="padding bg-white">
  25. <view class="flex flex-wrap justify-around">
  26. <l-button size="sm">小尺寸 (sm)</l-button>
  27. <l-button>默认尺寸 (df)</l-button>
  28. <l-button size="lg">大尺寸 (lg)</l-button>
  29. </view>
  30. </view>
  31. <l-demo-description>
  32. 添加 size="*" 属性,把*换成尺寸字符串(sm/df/lg)即可设置按钮大小
  33. </l-demo-description>
  34. <l-title>按钮颜色:</l-title>
  35. <view class="padding bg-white">
  36. <view class="flex flex-wrap">
  37. <l-button
  38. v-for="(item, index) of colors"
  39. :key="index"
  40. :color="item.name"
  41. class="margin-sm"
  42. >
  43. {{ item.title }} ({{ item.name }} | {{ item.color }})
  44. </l-button>
  45. </view>
  46. </view>
  47. <l-demo-description>添加 color="*" 属性,把*换成上述的颜色单词即可设置按钮颜色</l-demo-description>
  48. <l-title>镂空按钮:</l-title>
  49. <view class="padding bg-white">
  50. <view class="flex flex-wrap justify-around">
  51. <l-button color="red">普通按钮</l-button>
  52. <l-button line="red">镂空按钮</l-button>
  53. <l-button line="red" blod>加粗线条按钮</l-button>
  54. </view>
  55. </view>
  56. <l-demo-description>
  57. 添加 line="*" 属性,把*换成颜色单词即可设置镂空按钮;
  58. 添加blod属性即可使用粗线条型镂空按钮
  59. </l-demo-description>
  60. <l-title>按钮阴影:</l-title>
  61. <view class="padding bg-white">
  62. <view class="flex flex-wrap justify-around">
  63. <l-button color="red">普通按钮</l-button>
  64. <l-button color="red" shadow>带阴影按钮 (shadow)</l-button>
  65. </view>
  66. </view>
  67. <l-demo-description>添加 shadow 属性即可显示按钮阴影</l-demo-description>
  68. <l-title>块状按钮:</l-title>
  69. <view class="padding flex flex-direction">
  70. <l-button size="lg" color="blue" block>普通块状按钮 (block)</l-button>
  71. <l-button size="lg" color="blue" class="margin-top-sm" block>
  72. <l-icon color="white" type="likefill" class="margin-right-xs" />
  73. 带图标
  74. </l-button>
  75. <l-button size="lg" line="red" class="margin-top-sm" block>镂空块状按钮</l-button>
  76. <l-button size="lg" color="blue" class="margin-top-sm" block disabled>
  77. 禁用块状按钮
  78. </l-button>
  79. <l-button size="lg" line="red" class="margin-top-sm" block disabled>
  80. 禁用镂空块状按钮
  81. </l-button>
  82. </view>
  83. <l-demo-description>添加 block 属性即可使用块状按钮</l-demo-description>
  84. </view>
  85. </template>
  86. <script>
  87. export default {
  88. data() {
  89. return { colors: this.getUiColors() }
  90. }
  91. }
  92. </script>