index.wxml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <wxs src="../wxs/utils.wxs" module="utils" />
  2. <button
  3. id="{{ id }}"
  4. class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}"
  5. hover-class="van-button--active hover-class"
  6. lang="{{ lang }}"
  7. style="{{ baseStyle }} {{ customStyle }}"
  8. open-type="{{ openType }}"
  9. business-id="{{ businessId }}"
  10. session-from="{{ sessionFrom }}"
  11. send-message-title="{{ sendMessageTitle }}"
  12. send-message-path="{{ sendMessagePath }}"
  13. send-message-img="{{ sendMessageImg }}"
  14. show-message-card="{{ showMessageCard }}"
  15. app-parameter="{{ appParameter }}"
  16. aria-label="{{ ariaLabel }}"
  17. bindtap="onClick"
  18. bindgetuserinfo="bindGetUserInfo"
  19. bindcontact="bindContact"
  20. bindgetphonenumber="bindGetPhoneNumber"
  21. binderror="bindError"
  22. bindlaunchapp="bindLaunchApp"
  23. bindopensetting="bindOpenSetting"
  24. >
  25. <block wx:if="{{ loading }}">
  26. <van-loading
  27. custom-class="loading-class"
  28. size="{{ loadingSize }}"
  29. type="{{ loadingType }}"
  30. color="{{ loadingColor(type,color,plain) }}"
  31. />
  32. <view
  33. wx:if="{{ loadingText }}"
  34. class="van-button__loading-text"
  35. >
  36. {{ loadingText }}
  37. </view>
  38. </block>
  39. <block wx:else>
  40. <van-icon
  41. wx:if="{{ icon }}"
  42. size="1.2em"
  43. name="{{ icon }}"
  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>