[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="基本用法">
<van-radio-group value="{{ radio1 }}" data-key="radio1" bind:change="onChange" custom-class="demo-radio-group">
<demo-block title="基本用法" padding>
<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="2" custom-class="demo-radio">单选框 2</van-radio>
</van-radio-group>
</demo-block>
<demo-block title="禁用状态">
<van-radio-group value="{{ radio2 }}" data-key="radio2" bind:change="onChange" disabled custom-class="demo-radio-group">
<demo-block title="禁用状态" padding>
<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="2" custom-class="demo-radio">单选框 2</van-radio>
</van-radio-group>

View File

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

View File

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

View File

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

View File

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

View File

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