index.wxml 1.8KB

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="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. >
  28. <block wx:if="{{ loading }}">
  29. <van-loading
  30. custom-class="loading-class"
  31. size="{{ loadingSize }}"
  32. type="{{ loadingType }}"
  33. color="{{ computed.loadingColor({ type, color, plain }) }}"
  34. />
  35. <view wx:if="{{ loadingText }}" class="van-button__loading-text">
  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-prefix="{{ classPrefix }}"
  45. class="van-button__icon"
  46. custom-style="line-height: inherit;"
  47. />
  48. <view class="van-button__text">
  49. <slot />
  50. </view>
  51. </block>
  52. </button>