index.wxml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <wxs src="../wxs/utils.wxs" module="utils" />
  2. <wxs src="./index.wxs" module="computed" />
  3. <button
  4. id="{{ id }}"
  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. binderror="onError"
  25. bindlaunchapp="onLaunchApp"
  26. bindopensetting="onOpenSetting"
  27. bindchooseavatar="onChooseAvatar"
  28. >
  29. <block wx:if="{{ loading }}">
  30. <van-loading
  31. custom-class="loading-class"
  32. size="{{ loadingSize }}"
  33. type="{{ loadingType }}"
  34. color="{{ computed.loadingColor({ type, color, plain }) }}"
  35. />
  36. <view wx:if="{{ loadingText }}" class="van-button__loading-text">
  37. {{ loadingText }}
  38. </view>
  39. </block>
  40. <block wx:else>
  41. <van-icon
  42. wx:if="{{ icon }}"
  43. size="1.2em"
  44. name="{{ icon }}"
  45. class-prefix="{{ classPrefix }}"
  46. class="van-button__icon"
  47. custom-style="line-height: inherit;"
  48. />
  49. <view class="van-button__text">
  50. <slot />
  51. </view>
  52. </block>
  53. </button>