Skip to content

Commit

Permalink
feat: picker slot support get params
Browse files Browse the repository at this point in the history
  • Loading branch information
rayhomie committed Sep 24, 2024
1 parent e29a4b9 commit a640cbe
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 31 deletions.
7 changes: 6 additions & 1 deletion compiled/alipay/demo/pages/Picker/index.axml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@
placeholder="请选择"
title="请选择"
options="{{list}}"
></ant-picker>
>
<view
slot="content"
slot-scope="prop"
>已选择:{{prop.value}}</view>
</ant-picker>
</ant-list-item>
<view class="btn-wrapper">
<ant-button
Expand Down
36 changes: 23 additions & 13 deletions compiled/alipay/src/Picker/index.axml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,35 @@
style="{{style || ''}}"
onTap="onOpen"
>
<slot name="prefix"></slot>
<slot
name="prefix"
value="{{formatValue}}"
></slot>
<view class="ant-picker-value">
<slot name="content"></slot>
<view
a:if="{{formatValue}}"
class="ant-picker-value-text"
<slot
name="content"
value="{{formatValue}}"
>
{{formatValue}}
</view>
<block a:else>
<view
a:if="{{placeholder}}"
class="ant-picker-value-placeholder"
a:if="{{formatValue}}"
class="ant-picker-value-text"
>
{{placeholder}}
{{formatValue}}
</view>
</block>
<block a:else>
<view
a:if="{{placeholder}}"
class="ant-picker-value-placeholder"
>
{{placeholder}}
</view>
</block>
</slot>
</view>
<slot name="suffix"></slot>
<slot
name="suffix"
value="{{formatValue}}"
></slot>
</view>
<ant-popup
className="ant-picker-popup {{popClassName || ''}}"
Expand Down
7 changes: 6 additions & 1 deletion compiled/wechat/demo/pages/Picker/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@
placeholder="请选择"
title="请选择"
options="{{list}}"
></ant-picker>
>
<view
slot="content"
slot-scope="prop"
>已选择:{{prop.value}}</view>
</ant-picker>
</ant-list-item>
<view class="btn-wrapper">
<ant-button
Expand Down
10 changes: 8 additions & 2 deletions compiled/wechat/src/Picker/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
style="{{style || ''}}"
bind:tap="onOpen"
>
<slot name="prefix"></slot>
<slot
name="prefix"
value="{{formatValue}}"
></slot>
<view class="ant-picker-value">
<view
wx:if="{{formatValue}}"
Expand All @@ -20,7 +23,10 @@
>{{placeholder}}</view>
</block>
</view>
<slot name="suffix"></slot>
<slot
name="suffix"
value="{{formatValue}}"
></slot>
</view>
<ant-popup
className="ant-picker-popup {{popClassName || ''}}"
Expand Down
5 changes: 4 additions & 1 deletion demo/pages/Picker/index.axml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@
value="{{ value }}"
placeholder="请选择"
title="请选择"
options="{{ list }}" />
options="{{ list }}"
>
<view slot="content" slot-scope="prop" >已选择:{{prop.value}}</view>
</ant-picker>
</ant-list-item>
<view class="btn-wrapper">
<ant-button
Expand Down
29 changes: 16 additions & 13 deletions src/Picker/index.axml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,28 @@
class="ant-picker {{ disabled ? 'ant-picker-disabled' : '' }} {{ className || '' }}"
style="{{ style || '' }}"
onTap="onOpen">
<slot name="prefix" />
<slot name="prefix" value="{{formatValue}}" />
<view class="ant-picker-value">
<!-- #if ALIPAY -->
<slot name="content" />
<slot name="content" value="{{formatValue}}" >
<!-- #endif -->
<view
a:if="{{ formatValue }}"
class="ant-picker-value-text">
{{ formatValue }}
</view>
<block a:else>
<view
a:if="{{ placeholder }}"
class="ant-picker-value-placeholder">
{{ placeholder }}
a:if="{{ formatValue }}"
class="ant-picker-value-text">
{{ formatValue }}
</view>
</block>
<block a:else>
<view
a:if="{{ placeholder }}"
class="ant-picker-value-placeholder">
{{ placeholder }}
</view>
</block>
<!-- #if ALIPAY -->
</slot>
<!-- #endif -->
</view>
<slot name="suffix" />
<slot name="suffix" value="{{formatValue}}" />
</view>
<ant-popup
className="ant-picker-popup {{ popClassName || '' }}"
Expand Down

0 comments on commit a640cbe

Please sign in to comment.