Skip to content

Commit

Permalink
fix(picker): className option (#2926)
Browse files Browse the repository at this point in the history
  • Loading branch information
eiinu committed Feb 19, 2024
1 parent fef26d9 commit 1aa7d68
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 5 deletions.
8 changes: 7 additions & 1 deletion src/packages/__VUE/picker/Column.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
<view
v-if="item && item[fieldNames.text] && threeDimensional"
class="nut-picker-roller-item"
:class="{ 'nut-picker-roller-item-hidden': isHidden(index + 1) }"
:class="{
'nut-picker-roller-item-hidden': isHidden(index + 1),
[item[fieldNames.className]]: item[fieldNames.className]
}"
:style="setRollerStyle(index + 1)"
>
{{ item[fieldNames.text] }}
Expand All @@ -20,6 +23,9 @@
<view
v-if="item && item[fieldNames.text] && !threeDimensional"
class="nut-picker-roller-item-tile"
:class="{
[item[fieldNames.className]]: item[fieldNames.className]
}"
:style="{ height: pxCheck(optionHeight), lineHeight: pxCheck(optionHeight) }"
>
{{ item[fieldNames.text] }}
Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/picker/doc.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Use the children field of the Columns attribute to cascade options
| --- | --- | --- | --- |
| v-model:value | Default Index | Array | `[]` |
| columns | Columns data | PickerOption[] \| PickerOption[][] | - |
| field-names`v4.1.4` | custom columns field | object | `{ text: 'text', value: 'value', children: 'children' }` |
| field-names`v4.1.4` | custom columns field | object | `{ text: 'text', value: 'value', children: 'children', className: 'className' }` |
| title | Toolbar title | string | - |
| cancel-text | Text of cancel button | string | `cancel` |
| ok-text | Text of confirm button | string | `confirm` |
Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/picker/doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Picker 通常作为用于辅助表单填写,可以搭配 Popup 实现效果。
| --- | --- | --- | --- |
| v-model:value | 默认选中项 | Array | `[]` |
| columns | 对象数组,配置每一列显示的数据 | PickerOption[] \| PickerOption[][] | - |
| field-names`v4.1.4` | 自定义 columns 中的字段 | object | `{ text: 'text', value: 'value', children: 'children' }` |
| field-names`v4.1.4` | 自定义 columns 中的字段 | object | `{ text: 'text', value: 'value', children: 'children', className: 'className' }` |
| title | 设置标题 | string | - |
| cancel-text | 取消按钮文案 | string | `取消` |
| ok-text | 确定按钮文案 | string | `确定` |
Expand Down
2 changes: 1 addition & 1 deletion src/packages/__VUE/picker/doc.taro.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Picker 通常作为用于辅助表单填写,可以搭配 Popup 实现效果。
| --- | --- | --- | --- |
| v-model:value | 默认选中项 | Array | `[]` |
| columns | 对象数组,配置每一列显示的数据 | PickerOption[] \| PickerOption[][] | - |
| field-names`v4.1.4` | 自定义 columns 中的字段 | object | `{ text: 'text', value: 'value', children: 'children' }` |
| field-names`v4.1.4` | 自定义 columns 中的字段 | object | `{ text: 'text', value: 'value', children: 'children', className: 'className' }` |
| title | 设置标题 | string | - |
| cancel-text | 取消按钮文案 | string | `取消` |
| ok-text | 确定按钮文案 | string | `确定` |
Expand Down
3 changes: 3 additions & 0 deletions src/packages/__VUE/picker/index.taro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
v-for="(item, index) in column"
:key="item[columnFieldNames.value] ?? index"
class="nut-picker-roller-item-tarotile"
:class="{
[item[columnFieldNames.className]]: item[columnFieldNames.className]
}"
:style="{
lineHeight: pxCheck(optionHeight)
}"
Expand Down
1 change: 1 addition & 0 deletions src/packages/__VUE/picker/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ export interface PickerFieldNames {
text?: string;
value?: string;
children?: string;
className?: string;
}
3 changes: 2 additions & 1 deletion src/packages/__VUE/picker/usePicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { PickerOption, PickerFieldNames } from './types';
const DEFAULT_FILED_NAMES = {
text: 'text',
value: 'value',
children: 'children'
children: 'children',
className: 'className'
};

export const usePicker = (props: any, emit: any) => {
Expand Down

0 comments on commit 1aa7d68

Please sign in to comment.