wxc-button

    1. <view class="container">
    2. <view class="title">普通按钮</view>
    3. <view class="button-wrap" wx:for="{{types}}" wx:for-item="type" wx:key="key">
    4. <wxc-button size="normal" type="{{type}}" value="{{type}}"></wxc-button>
    5. </view>
    6. </view>
    7. <view class="container">
    8. <view class="title">镂空按钮</view>
    9. <view class="button-wrap" wx:for="{{types}}" wx:for-item="type" wx:key="key">
    10. <wxc-button plain="{{true}}" size="normal" type="{{type}}" value="{{type}}"></wxc-button>
    11. </view>
    12. </view>
    13. <view class="container">
    14. <view class="title">小按钮</view>
    15. <view class="button-small-wrap">
    16. <wxc-button size="small" type="beauty" value="small"></wxc-button>
    17. </view>
    18. <view class="button-small-wrap">
    19. <wxc-button plain="{{true}}" size="small" type="beauty" value="small"></wxc-button>
    20. </view>
    21. </view>
    22. <view class="container">
    23. <view class="title">大按钮带 loading 状态</view>
    24. <view class="button-large-wrap">
    25. <wxc-button size="large" type="beauty" loading="{{true}}" value="large button"></wxc-button>
    26. </view>
    27. <view class="button-large-wrap">
    28. <wxc-button plain="{{true}}" size="large" type="beauty" loading="{{true}}" value="large button"></wxc-button>
    29. </view>
    30. <view class="container">
    31. <view class="title">自定义按钮</view>
    32. <view class="button-small-wrap">
    33. <wxc-button type="beauty" btnStyle="min-width: 66rpx;padding: 0;border-radius: 66rpx"><wxc-icon color="#fff" size="36" type="cart"></wxc-icon></wxc-button>
    34. </view>
    35. <view class="button-small-wrap">
    36. <wxc-button btnStyle="{{style}}">预约直播 <wxc-icon color="#fff" type="arrow-right"></wxc-icon></wxc-button>
    37. </view>
    38. <view class="button-small-wrap">
    39. <wxc-button type="beauty" btnStyle="width: 312rpx;">立即换购</wxc-button>
    40. </view>
    41. </view>
    42. <view class="container">
    43. <view class="title">表单</view>
    44. <view class="button-small-wrap">
    45. <wxc-button bindsubmit="onSubmit" type="beauty" btnStyle="width: 312rpx;">按钮</wxc-button>
    46. </view>
    47. </view>
    48. </template>
    49. <script>
    50. export default {
    51. config: {
    52. usingComponents: {
    53. 'wxc-button': '@minui/wxc-button',
    54. 'wxc-icon': '@minui/wxc-icon'
    55. }
    56. },
    57. data: {
    58. types: [
    59. 'beauty', 'selection', 'disabled',
    60. 'danger', 'success', 'secondary',
    61. 'primary', 'info', 'dark', 'warning'
    62. ],
    63. style: 'width: 222rpx;background: #ff9300;border-radius: 66rpx;color: #fff;'
    64. },
    65. /** note: 在 wxp 文件或者页面文件中请去掉 methods 包装 */
    66. methods: {
    67. console.log(e.detail.formId)
    68. }
    69. }
    70. </script>
    71. <style>
    72. .container {
    73. width: 100%;
    74. padding-top: 20rpx;
    75. background: #fff;
    76. text-align: center;
    77. }
    78. .container:after {
    79. display: block;
    80. content: " ";
    81. clear:both;
    82. visibility:hidden;
    83. height:0;
    84. }
    85. .title {
    86. line-height: 50rpx;
    87. margin-left:35rpx;
    88. margin-bottom:10rpx;
    89. text-align:left;
    90. font-weight: bold;
    91. font-size: 30rpx;
    92. color: #333;
    93. }
    94. .button-wrap {
    95. margin:0 0 10rpx 35rpx;
    96. float: left;
    97. }
    98. .button-large-wrap {
    99. margin-bottom: 10rpx;
    100. }
    101. .button-small-wrap {
    102. margin:0 0 10rpx 30rpx;
    103. float: left;
    104. }
    105. </style>

    Button

    • 小程序组件系统中组件是隔离的,组件外层套 form 标签时两者是不通的,现在组件中内置 form 标签用于获取 formId
    • 小程序组件系统中组件是隔离的,所以提交表单时无法用 form 表单获取输入框中的值,只能单独获取。

    v1.0.1(2018-6-5)

    v1.0.0(2018-02-26)

    • 初始版本