<wxs src="../wxs/base.wxs" module="Utils" />
<wxs module="wxs" src="./button.wxs"></wxs>
<!-- <view class="keyboard" bind:touchstart="{{wxs.keypadTouchStart}}" bind:touchend="{{wxs.keypadTouchEnd}}"> -->

<button
    data-id="test-toy-button-id"
    class="toy-button toy-button--{{type}} {{flat ? 'toy-button--flat' : ''}} {{Utils.classNames({disabled: disabled, loading: loading, plain: plain })}} custom-class"
    data-disabled="{{disabled}}"
    data-loading="{{loading}}"
    style="{{style}};{{width ? 'width:' + width + ';' : ''}};{{height ? 'height:' + height + ';' : ''}}"
    session-from="{{ sessionFrom }}"
    open-type="{{ disabled || loading ? '' : openType }}"
    send-message-title="{{ sendMessageTitle }}"
    send-message-path="{{ sendMessagePath }}"
    send-message-img="{{ sendMessageImg }}"
    show-message-card="{{ showMessageCard }}"
    app-parameter="{{ appParameter }}"
    aria-label="{{ ariaLabel }}"
    bind:touchstart="{{wxs.touchStart}}"
    bind:touchend="{{wxs.touchEnd}}"
    bind:tap="{{ 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 }}">
        <van-loading
            custom-class="loading-class"
            size="{{ loadingSize || iconSize }}"
            type="{{ loadingType }}"
            color="{{ loadingColor }}" />
    </block>
    <block wx:else>
        <van-icon
            wx:if="{{ icon }}"
            name="{{ icon }}"
            size="{{ iconSize }}"
            color="{{ wxs.getIconColor(iconColor, type, plain, disabled) }}"
            class-prefix="{{ iconClassPrefix }}"
            class="toy-button__icon" />
    </block>
    <slot></slot>
</button>
