Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复picker的内置空状态中文文案和空状态判断问题 #1135

Merged
merged 3 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion compiled/alipay/demo/pages/Picker/index.axml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
placeholder="请选择"
title="请选择"
onChange="handleChange"
options="{{ list }}" />
options="{{ list }}"
emptyText="暂无数据" />
</ant-list-item>
<ant-list-item>
选择城市(点击蒙层不关闭)
Expand Down
4 changes: 2 additions & 2 deletions compiled/alipay/src/Picker/index.axml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</view>
<view class="ant-picker-content">
<slot name="content-header" />
<block a:if="{{ columns }}">
<block a:if="{{ columns.length > 0 }}">
<picker-view
class="ant-picker-picker-view"
mask-style="{{ maskStyle || '' }}"
Expand Down Expand Up @@ -87,7 +87,7 @@
<picker-view>
<picker-view-column>
<!-- display: inline -->
<text style="color: #ccc">暂无数据</text>
<text style="color: #ccc">{{ emptyText }}</text>
</picker-view-column>
</picker-view>
</block>
Expand Down
1 change: 1 addition & 0 deletions compiled/alipay/src/Picker/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Picker 选择器显示一个或多个选项集合的可滚动列表,相比于
| maskClosable | 点击蒙层是否可以关闭 | boolean |true | |
| maskStyle | 蒙层的样式 | string | - |
| okText | 确认按钮文案 | string | '确定' |
| emptyText | 空状态按钮文案 | string | '暂无数据' |
| options | picker 数据,配置每一列的选项 | [PickerColumnItem](#pickercolumnitem)[] | [] |
| placeholder | 提示文案 | string | '请选择' |
| popClassName | 弹出框类名 | string | - |
Expand Down
7 changes: 7 additions & 0 deletions compiled/alipay/src/Picker/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ export interface IPickerProps extends IBaseProps {
* @default '请选择'
*/
placeholder: string;
/**
* @description 空状态提示文案
* @default '暂无数据'
*/
emptyText?: string;
/**
* @description picker 数据
*/
Expand Down Expand Up @@ -133,6 +138,7 @@ export const PickerDefaultProps: Partial<IPickerProps> = {
options: [],
placeholder: '请选择',
defaultValue: [],
emptyText: '暂无数据'
};

export const PickerFunctionalProps: Partial<IPickerProps> = {
Expand All @@ -152,4 +158,5 @@ export const PickerFunctionalProps: Partial<IPickerProps> = {
popStyle: '',
maskClosable: true,
onFormat: null,
emptyText: '暂无数据'
};
3 changes: 2 additions & 1 deletion compiled/wechat/demo/pages/Picker/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
placeholder="请选择"
title="请选择"
bind:change="handleChange"
options="{{ list }}" />
options="{{ list }}"
emptyText="暂无数据" />
</ant-list-item>
<ant-list-item>
选择城市(点击蒙层不关闭)
Expand Down
1 change: 1 addition & 0 deletions compiled/wechat/src/Picker/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Picker 选择器显示一个或多个选项集合的可滚动列表,相比于
| maskClosable | 点击蒙层是否可以关闭 | boolean |true | |
| maskStyle | 蒙层的样式 | string | - |
| okText | 确认按钮文案 | string | '确定' |
| emptyText | 空状态按钮文案 | string | '暂无数据' |
| options | picker 数据,配置每一列的选项 | [PickerColumnItem](#pickercolumnitem)[] | [] |
| placeholder | 提示文案 | string | '请选择' |
| popClassName | 弹出框类名 | string | - |
Expand Down
4 changes: 2 additions & 2 deletions compiled/wechat/src/Picker/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</view>
<view class="ant-picker-content">
<slot name="content-header" />
<block wx:if="{{ columns }}">
<block wx:if="{{ columns.length > 0 }}">
<picker-view
class="ant-picker-picker-view"
mask-style="{{ maskStyle || '' }}"
Expand Down Expand Up @@ -82,7 +82,7 @@
<picker-view>
<picker-view-column>
<!-- display: inline -->
<text style="color: #ccc">暂无数据</text>
<text style="color: #ccc">{{ emptyText }}</text>
</picker-view-column>
</picker-view>
</block>
Expand Down
2 changes: 2 additions & 0 deletions compiled/wechat/src/Picker/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export var PickerDefaultProps = {
options: [],
placeholder: '请选择',
defaultValue: [],
emptyText: '暂无数据'
};
export var PickerFunctionalProps = {
formattedValueText: null,
Expand All @@ -24,4 +25,5 @@ export var PickerFunctionalProps = {
popStyle: '',
maskClosable: true,
onFormat: null,
emptyText: '暂无数据'
};
1 change: 1 addition & 0 deletions demo/pages/Picker/index.axml.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default ({
title="请选择"
onChange="handleChange"
options={list}
emptyText="暂无数据"
></AntPicker>
</AntListItem>
<AntListItem>
Expand Down
5 changes: 3 additions & 2 deletions src/Picker/index.axml.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default (
indicatorStyle,
indicatorClassName,
options,
emptyText
}: TSXMLProps<IPickerProps>,
{ state, formatValue, selectedIndex, columns }: InternalData
) => (
Expand Down Expand Up @@ -98,7 +99,7 @@ export default (
</View>
<View class="ant-picker-content">
<Slot name="content-header" />
{columns ? (
{columns.length > 0 ? (
<Block>
<PickerView
class="ant-picker-picker-view"
Expand Down Expand Up @@ -127,7 +128,7 @@ export default (
<Block>
<PickerView>
<PickerViewColumn>
<Text style="color: #ccc">暂无数据</Text>
<Text style="color: #ccc">{emptyText}</Text>
</PickerViewColumn>
</PickerView>
</Block>
Expand Down
1 change: 1 addition & 0 deletions src/Picker/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Picker 选择器显示一个或多个选项集合的可滚动列表,相比于
| maskClosable | 点击蒙层是否可以关闭 | boolean |true | |
| maskStyle | 蒙层的样式 | string | - |
| okText | 确认按钮文案 | string | '确定' |
| emptyText | 空状态按钮文案 | string | '暂无数据' |
| options | picker 数据,配置每一列的选项 | [PickerColumnItem](#pickercolumnitem)[] | [] |
| placeholder | 提示文案 | string | '请选择' |
| popClassName | 弹出框类名 | string | - |
Expand Down
7 changes: 7 additions & 0 deletions src/Picker/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ export interface IPickerProps extends IBaseProps {
* @default '请选择'
*/
placeholder: string;
/**
* @description 空状态提示文案
* @default '暂无数据'
*/
emptyText?: string;
/**
* @description picker 数据
*/
Expand Down Expand Up @@ -133,6 +138,7 @@ export const PickerDefaultProps: Partial<IPickerProps> = {
options: [],
placeholder: '请选择',
defaultValue: [],
emptyText: '暂无数据'
};

export const PickerFunctionalProps: Partial<IPickerProps> = {
Expand All @@ -152,4 +158,5 @@ export const PickerFunctionalProps: Partial<IPickerProps> = {
popStyle: '',
maskClosable: true,
onFormat: null,
emptyText: '暂无数据'
};
Loading