<wxs module="utils" src="../wxs/utils.wxs"/>
<wxs module="computed" src="./index.wxs"/>

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