index.wxml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <wxs src="../wxs/utils.wxs" module="utils" />
  2. <wxs src="./index.wxs" module="computed" />
  3. <button
  4. id="{{ id || buttonId }}"
  5. data-detail="{{ dataset }}"
  6. class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}"
  7. hover-class="{{ disabled || loading ? '' : 'van-button--active hover-class'}}"
  8. lang="{{ lang }}"
  9. form-type="{{ formType }}"
  10. style="{{ computed.rootStyle({ plain, color, customStyle }) }}"
  11. open-type="{{ disabled || loading || (canIUseGetUserProfile && openType === 'getUserInfo') ? '' : openType }}"
  12. business-id="{{ businessId }}"
  13. session-from="{{ sessionFrom }}"
  14. send-message-title="{{ sendMessageTitle }}"
  15. send-message-path="{{ sendMessagePath }}"
  16. send-message-img="{{ sendMessageImg }}"
  17. show-message-card="{{ showMessageCard }}"
  18. app-parameter="{{ appParameter }}"
  19. aria-label="{{ ariaLabel }}"
  20. bindtap="{{ disabled || loading ? '' : 'onClick' }}"
  21. bindgetuserinfo="onGetUserInfo"
  22. bindcontact="onContact"
  23. bindgetphonenumber="onGetPhoneNumber"
  24. bindgetrealtimephonenumber="onGetRealTimePhoneNumber"
  25. bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
  26. binderror="onError"
  27. bindlaunchapp="onLaunchApp"
  28. bindopensetting="onOpenSetting"
  29. bindchooseavatar="onChooseAvatar"
  30. >
  31. <block wx:if="{{ loading }}">
  32. <van-loading
  33. custom-class="loading-class"
  34. size="{{ loadingSize }}"
  35. type="{{ loadingType }}"
  36. color="{{ computed.loadingColor({ type, color, plain }) }}"
  37. />
  38. <view wx:if="{{ loadingText }}" class="van-button__loading-text">
  39. {{ loadingText }}
  40. </view>
  41. </block>
  42. <block wx:else>
  43. <van-icon
  44. wx:if="{{ icon }}"
  45. size="1.2em"
  46. name="{{ icon }}"
  47. class-prefix="{{ classPrefix }}"
  48. class="van-button__icon"
  49. custom-style="line-height: inherit;"
  50. />
  51. <view class="van-button__text">
  52. <slot />
  53. </view>
  54. </block>
  55. </button>