index.wxml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <wxs src="../wxs/utils.wxs" module="utils" />
  2. <button
  3. id="{{ id }}"
  4. data-detail="{{ dataset }}"
  5. class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}"
  6. hover-class="van-button--active hover-class"
  7. lang="{{ lang }}"
  8. form-type="{{ formType }}"
  9. style="{{ baseStyle }} {{ customStyle }}"
  10. open-type="{{ disabled ? '' : openType }}"
  11. business-id="{{ businessId }}"
  12. session-from="{{ sessionFrom }}"
  13. send-message-title="{{ sendMessageTitle }}"
  14. send-message-path="{{ sendMessagePath }}"
  15. send-message-img="{{ sendMessageImg }}"
  16. show-message-card="{{ showMessageCard }}"
  17. app-parameter="{{ appParameter }}"
  18. aria-label="{{ ariaLabel }}"
  19. bindtap="{{ !disabled ? 'onClick' : 'noop' }}"
  20. bindgetuserinfo="bindGetUserInfo"
  21. bindcontact="bindContact"
  22. bindgetphonenumber="bindGetPhoneNumber"
  23. binderror="bindError"
  24. bindlaunchapp="bindLaunchApp"
  25. bindopensetting="bindOpenSetting"
  26. >
  27. <block wx:if="{{ loading }}">
  28. <van-loading
  29. custom-class="loading-class"
  30. size="{{ loadingSize }}"
  31. type="{{ loadingType }}"
  32. color="{{ loadingColor(type,color,plain) }}"
  33. />
  34. <view wx:if="{{ loadingText }}" class="van-button__loading-text">
  35. {{ loadingText }}
  36. </view>
  37. </block>
  38. <block wx:else>
  39. <van-icon
  40. wx:if="{{ icon }}"
  41. size="1.2em"
  42. name="{{ icon }}"
  43. class-prefix="{{ classPrefix }}"
  44. class="van-button__icon"
  45. custom-style="line-height: inherit;"
  46. />
  47. <view class="van-button__text">
  48. <slot />
  49. </view>
  50. </block>
  51. </button>
  52. <wxs module="loadingColor">
  53. function get(type, color,plain) {
  54. if(plain) {
  55. return color ? color: '#c9c9c9';
  56. }
  57. if(type === 'default') {
  58. return '#c9c9c9';
  59. }
  60. return 'white';
  61. }
  62. module.exports = get;
  63. </wxs>