Skip to content

Commit 73b809b

Browse files
authored
Fix wx picker slot (#1280)
* feat: wechat support slot * feat: picker slot support get params
1 parent d4a3866 commit 73b809b

File tree

6 files changed

+63
-31
lines changed

6 files changed

+63
-31
lines changed

compiled/alipay/demo/pages/Picker/index.axml

+6-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@
4040
placeholder="请选择"
4141
title="请选择"
4242
options="{{list}}"
43-
></ant-picker>
43+
>
44+
<view
45+
slot="content"
46+
slot-scope="prop"
47+
>已选择:{{prop.value}}</view>
48+
</ant-picker>
4449
</ant-list-item>
4550
<view class="btn-wrapper">
4651
<ant-button

compiled/alipay/src/Picker/index.axml

+23-13
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,35 @@
77
style="{{style || ''}}"
88
onTap="onOpen"
99
>
10-
<slot name="prefix"></slot>
10+
<slot
11+
name="prefix"
12+
value="{{formatValue}}"
13+
></slot>
1114
<view class="ant-picker-value">
12-
<slot name="content"></slot>
13-
<view
14-
a:if="{{formatValue}}"
15-
class="ant-picker-value-text"
15+
<slot
16+
name="content"
17+
value="{{formatValue}}"
1618
>
17-
{{formatValue}}
18-
</view>
19-
<block a:else>
2019
<view
21-
a:if="{{placeholder}}"
22-
class="ant-picker-value-placeholder"
20+
a:if="{{formatValue}}"
21+
class="ant-picker-value-text"
2322
>
24-
{{placeholder}}
23+
{{formatValue}}
2524
</view>
26-
</block>
25+
<block a:else>
26+
<view
27+
a:if="{{placeholder}}"
28+
class="ant-picker-value-placeholder"
29+
>
30+
{{placeholder}}
31+
</view>
32+
</block>
33+
</slot>
2734
</view>
28-
<slot name="suffix"></slot>
35+
<slot
36+
name="suffix"
37+
value="{{formatValue}}"
38+
></slot>
2939
</view>
3040
<ant-popup
3141
className="ant-picker-popup {{popClassName || ''}}"

compiled/wechat/demo/pages/Picker/index.wxml

+6-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@
3434
placeholder="请选择"
3535
title="请选择"
3636
options="{{list}}"
37-
></ant-picker>
37+
>
38+
<view
39+
slot="content"
40+
slot-scope="prop"
41+
>已选择:{{prop.value}}</view>
42+
</ant-picker>
3843
</ant-list-item>
3944
<view class="btn-wrapper">
4045
<ant-button

compiled/wechat/src/Picker/index.wxml

+8-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
style="{{style || ''}}"
88
bind:tap="onOpen"
99
>
10-
<slot name="prefix"></slot>
10+
<slot
11+
name="prefix"
12+
value="{{formatValue}}"
13+
></slot>
1114
<view class="ant-picker-value">
1215
<view
1316
wx:if="{{formatValue}}"
@@ -20,7 +23,10 @@
2023
>{{placeholder}}</view>
2124
</block>
2225
</view>
23-
<slot name="suffix"></slot>
26+
<slot
27+
name="suffix"
28+
value="{{formatValue}}"
29+
></slot>
2430
</view>
2531
<ant-popup
2632
className="ant-picker-popup {{popClassName || ''}}"

demo/pages/Picker/index.axml

+4-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@
3737
value="{{ value }}"
3838
placeholder="请选择"
3939
title="请选择"
40-
options="{{ list }}" />
40+
options="{{ list }}"
41+
>
42+
<view slot="content" slot-scope="prop" >已选择:{{prop.value}}</view>
43+
</ant-picker>
4144
</ant-list-item>
4245
<view class="btn-wrapper">
4346
<ant-button

src/Picker/index.axml

+16-13
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,28 @@
66
class="ant-picker {{ disabled ? 'ant-picker-disabled' : '' }} {{ className || '' }}"
77
style="{{ style || '' }}"
88
onTap="onOpen">
9-
<slot name="prefix" />
9+
<slot name="prefix" value="{{formatValue}}" />
1010
<view class="ant-picker-value">
1111
<!-- #if ALIPAY -->
12-
<slot name="content" />
12+
<slot name="content" value="{{formatValue}}" >
1313
<!-- #endif -->
14-
<view
15-
a:if="{{ formatValue }}"
16-
class="ant-picker-value-text">
17-
{{ formatValue }}
18-
</view>
19-
<block a:else>
2014
<view
21-
a:if="{{ placeholder }}"
22-
class="ant-picker-value-placeholder">
23-
{{ placeholder }}
15+
a:if="{{ formatValue }}"
16+
class="ant-picker-value-text">
17+
{{ formatValue }}
2418
</view>
25-
</block>
19+
<block a:else>
20+
<view
21+
a:if="{{ placeholder }}"
22+
class="ant-picker-value-placeholder">
23+
{{ placeholder }}
24+
</view>
25+
</block>
26+
<!-- #if ALIPAY -->
27+
</slot>
28+
<!-- #endif -->
2629
</view>
27-
<slot name="suffix" />
30+
<slot name="suffix" value="{{formatValue}}" />
2831
</view>
2932
<ant-popup
3033
className="ant-picker-popup {{ popClassName || '' }}"

0 commit comments

Comments
 (0)