vant-weapp/dist/field/index.wxml
2018-08-07 15:10:21 +08:00

71 lines
2.5 KiB
Plaintext

<van-cell
icon="{{ leftIcon }}"
title="{{ label }}"
center="{{ center }}"
border="{{ border }}"
is-link="{{ isLink }}"
required="{{ required }}"
custom-style="{{ customStyle }}"
title-width="90px"
custom-class="{{ customClass }} van-field {{ labelAlign ? 'van-field--label-' + labelAlign : '' }}"
>
<slot name="label" slot="title" />
<view class="van-field__body {{ type === 'textarea' ? 'van-field__body--textarea' : '' }}">
<textarea
wx:if="{{ type === 'textarea' }}"
class="input-class van-field__control van-field__textarea {{ inputAlign ? 'van-field--' + inputAlign : '' }} {{ error ? 'van-field--error' : '' }} {{ disabled ? 'van-field__control--disabled' : '' }}"
focus="{{ focus }}"
value="{{ currentValue }}"
disabled="{{ disabled }}"
readonly="{{ readonly }}"
maxlength="{{ maxlength }}"
placeholder="{{ placeholder }}"
auto-height="{{ autosize }}"
placeholder-class="{{ placeholderClass }} {{ error ? 'van-field--error' : '' }}"
cursor-spacing="{{ cursorSpacing }}"
bindinput="onInput"
bind:blur="onBlur"
bind:focus="onFocus"
bind:confirm="onConfirm"
/>
<input
wx:else
class="input-class van-field__control {{ inputAlign ? 'van-field--' + inputAlign : '' }} {{ error ? 'van-field--error' : '' }} {{ disabled ? 'van-field__control--disabled' : '' }}"
type="{{ type }}"
focus="{{ focus }}"
value="{{ currentValue }}"
disabled="{{ disabled }}"
readonly="{{ readonly }}"
maxlength="{{ maxlength }}"
placeholder="{{ placeholder }}"
placeholder-class="{{ placeholderClass }} {{ error ? 'van-field--error' : '' }}"
confirm-type="{{ confirmType }}"
cursor-spacing="{{ cursorSpacing }}"
bindinput="onInput"
bind:blur="onBlur"
bind:focus="onFocus"
bind:confirm="onConfirm"
/>
<van-icon
wx:if="{{ showClear }}"
name="clear"
custom-class="van-field__clear"
bind:touchstart="onClear"
/>
<view class="van-field__icon-container" wx:if="{{ icon || useIconSlot }}" bind:tap="onTapIcon">
<van-icon
wx:if="{{ icon }}"
name="{{ icon }}"
custom-class="van-field__icon {{ iconClass }}"
/>
<slot wx:else name="icon" />
</view>
<view wx:if="{{ useButtonSlot }}" class="van-field__button">
<slot name="button" />
</view>
</view>
<view wx:if="{{ errorMessage }}" class="van-field__error-message">
{{ errorMessage }}
</view>
</van-cell>