<wxs src="../../wxs/utils.wxs" module="utils" />
<wxs src="./index.wxs" module="computed" />
<!-- hover-class="{{ disabled || loading ? '' : 'aio-button--active hover-class'}}" -->
<button
  id="{{ id || buttonId }}"
  data-detail="{{ dataset }}"
  class="aio-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading, special }]) }} {{ hairline ? 'aio-hairline--surround' : '' }}"
  lang="{{ lang }}"
  form-type="{{ formType }}"
  style="{{ computed.rootStyle({ plain, color, customStyle, width, height }) }}"
  open-type="{{ disabled || loading || (canIUseGetUserProfile && openType === 'getUserInfo') ? '' : openType }}"
  business-id="{{ businessId }}"
  session-from="{{ sessionFrom }}"
  send-message-title="{{ sendMessageTitle }}"
  send-message-path="{{ sendMessagePath }}"
  send-message-img="{{ sendMessageImg }}"
  show-message-card="{{ showMessageCard }}"
  app-parameter="{{ appParameter }}"
  aria-label="{{ ariaLabel }}"
  bindtap="{{ disabled || loading ? '' : 'onClick' }}"
  bindgetuserinfo="onGetUserInfo"
  bindcontact="onContact"
  bindgetphonenumber="onGetPhoneNumber"
  bindgetrealtimephonenumber="onGetRealTimePhoneNumber"
  bindagreeprivacyauthorization="onAgreePrivacyAuthorization"
  binderror="onError"
  bindlaunchapp="onLaunchApp"
  bindopensetting="onOpenSetting"
  bindchooseavatar="onChooseAvatar"
>
  <block wx:if="{{ loading }}">
    <aio-loading
      aio-class="loading-class"
      size="{{ loadingSize }}"
      type="{{ loadingType }}"
      color="{{ computed.loadingColor({ type, color, plain }) }}"
    />
    <view wx:if="{{ loadingText }}" class="aio-button__loading-text">
      {{ loadingText }}
    </view>
  </block>
  <block wx:else>
    <aio-image
      wx:if="{{ icon }}"
      name="{{ icon }}"
      width="{{ iconSize }}"
      height="{{ iconSize }}"
      class="aio-button__icon"
    />
    <view class="aio-button__text">
      <slot />
    </view>
  </block>
</button>
