[improvement] optimize wxml (#858)

This commit is contained in:
neverland 2018-11-06 14:49:38 +08:00 committed by GitHub
parent 0de7ec38e4
commit a234c97852
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 59 additions and 57 deletions

View File

@ -1,12 +1,23 @@
<demo-block title="基本用法"> <demo-block title="基本用法" padding>
<van-radio-group value="{{ radio1 }}" data-key="radio1" bind:change="onChange" custom-class="demo-radio-group"> <van-radio-group
value="{{ radio1 }}"
data-key="radio1"
custom-class="demo-radio-group"
bind:change="onChange"
>
<van-radio name="1" custom-class="demo-radio">单选框 1</van-radio> <van-radio name="1" custom-class="demo-radio">单选框 1</van-radio>
<van-radio name="2" custom-class="demo-radio">单选框 2</van-radio> <van-radio name="2" custom-class="demo-radio">单选框 2</van-radio>
</van-radio-group> </van-radio-group>
</demo-block> </demo-block>
<demo-block title="禁用状态"> <demo-block title="禁用状态" padding>
<van-radio-group value="{{ radio2 }}" data-key="radio2" bind:change="onChange" disabled custom-class="demo-radio-group"> <van-radio-group
disabled
value="{{ radio2 }}"
data-key="radio2"
custom-class="demo-radio-group"
bind:change="onChange"
>
<van-radio name="1" custom-class="demo-radio">单选框 1</van-radio> <van-radio name="1" custom-class="demo-radio">单选框 1</van-radio>
<van-radio name="2" custom-class="demo-radio">单选框 2</van-radio> <van-radio name="2" custom-class="demo-radio">单选框 2</van-radio>
</van-radio-group> </van-radio-group>

View File

@ -1,3 +1 @@
<view class="custom-class"> <slot />
<slot />
</view>

View File

@ -1,3 +1 @@
<view class="custom-class"> <slot />
<slot />
</view>

View File

@ -2,29 +2,28 @@
class="van-search custom-class {{ showAction || useActionSlot ? 'van-search--show-action' : '' }}" class="van-search custom-class {{ showAction || useActionSlot ? 'van-search--show-action' : '' }}"
style="background: {{ background }}" style="background: {{ background }}"
> >
<view class="van-search__field"> <van-field
<van-field clearable
clearable type="search"
type="search" left-icon="search"
left-icon="search" focus="{{ focus }}"
focus="{{ focus }}" error="{{ error }}"
error="{{ error }}" border="{{ false }}"
border="{{ false }}" confirm-type="search"
confirm-type="search" class="van-search__field"
value="{{ value }}" value="{{ value }}"
disabled="{{ disabled }}" disabled="{{ disabled }}"
readonly="{{ readony }}" readonly="{{ readony }}"
maxlength="{{ maxlength }}" maxlength="{{ maxlength }}"
input-align="{{ inputAlign }}" input-align="{{ inputAlign }}"
placeholder="{{ placeholder }}" placeholder="{{ placeholder }}"
placeholder-style="{{ placeholderStyle }}" placeholder-style="{{ placeholderStyle }}"
custom-style="padding: 3px 10px" custom-style="padding: 3px 10px"
bind:blur="onBlur" bind:blur="onBlur"
bind:focus="onFocus" bind:focus="onFocus"
bind:change="onChange" bind:change="onChange"
bind:confirm="onSearch" bind:confirm="onSearch"
/> />
</view>
<view wx:if="{{ showAction || useActionSlot }}" class="van-search__action"> <view wx:if="{{ showAction || useActionSlot }}" class="van-search__action">
<slot wx:if="{{ useActionSlot }}" name="action" /> <slot wx:if="{{ useActionSlot }}" name="action" />
<view wx:else bind:tap="onCancel" class="cancel-class">取消</view> <view wx:else bind:tap="onCancel" class="cancel-class">取消</view>

View File

@ -1,22 +1,22 @@
<view <view
class="van-swipe-cell" class="van-swipe-cell"
data-key="cell" data-key="cell"
bindtap="onClick" bindtap="onClick"
bindtouchstart="startDrag" bindtouchstart="startDrag"
bindtouchmove="onDrag" bindtouchmove="onDrag"
bindtouchend="endDrag" bindtouchend="endDrag"
bindtouchcancel="endDrag" bindtouchcancel="endDrag"
>
<view
style="{{ wrapperStyle }}"
bindtransitionend="onTransitionend"
> >
<view <view wx:if="{{ leftWidth }}" class="van-swipe-cell__left" data-key="left" catch:tap="onClick">
style="{{ wrapperStyle }}" <slot name="left" />
bindtransitionend="onTransitionend" </view>
> <slot />
<view wx:if="{{ leftWidth }}" class="van-swipe-cell__left" data-key="left" catch:tap="onClick"> <view wx:if="{{ rightWidth }}" class="van-swipe-cell__right" data-key="right" catch:tap="onClick">
<slot name="left" /> <slot name="right" />
</view>
<slot />
<view wx:if="{{ rightWidth }}" class="van-swipe-cell__right" data-key="right" catch:tap="onClick">
<slot name="right" />
</view>
</view> </view>
</view> </view>
</view>

View File

@ -5,12 +5,8 @@
<view class="van-tabbar-item__icon {{ dot ? 'van-tabbar-item__icon--dot' : '' }}"> <view class="van-tabbar-item__icon {{ dot ? 'van-tabbar-item__icon--dot' : '' }}">
<van-icon wx:if="{{ icon }}" name="{{ icon }}" info="{{ info }}" /> <van-icon wx:if="{{ icon }}" name="{{ icon }}" info="{{ info }}" />
<block wx:else> <block wx:else>
<block wx:if="{{ active }}"> <slot wx:if="{{ active }}" name="icon-active" />
<slot name="icon-active" /> <slot wx:else name="icon" />
</block>
<block wx:else>
<slot name="icon" />
</block>
<view wx:if="{{ info !== null }}" class="van-icon__info">{{ info }}</view> <view wx:if="{{ info !== null }}" class="van-icon__info">{{ info }}</view>
</block> </block>
</view> </view>