mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Area): add toolbar、confirm、cancel slots (#8969)
This commit is contained in:
parent
32f7be0ec2
commit
edb6ea8858
@ -24,6 +24,24 @@ import { Picker } from '../picker';
|
|||||||
const [name, bem] = createNamespace('area');
|
const [name, bem] = createNamespace('area');
|
||||||
|
|
||||||
const EMPTY_CODE = '000000';
|
const EMPTY_CODE = '000000';
|
||||||
|
const INHERIT_SLOTS = [
|
||||||
|
'title',
|
||||||
|
'cancel',
|
||||||
|
'confirm',
|
||||||
|
'toolbar',
|
||||||
|
'columns-top',
|
||||||
|
'columns-bottom',
|
||||||
|
] as const;
|
||||||
|
const INHERIT_PROPS = [
|
||||||
|
'title',
|
||||||
|
'loading',
|
||||||
|
'readonly',
|
||||||
|
'itemHeight',
|
||||||
|
'swipeDuration',
|
||||||
|
'visibleItemCount',
|
||||||
|
'cancelButtonText',
|
||||||
|
'confirmButtonText',
|
||||||
|
] as const;
|
||||||
|
|
||||||
function isOverseaCode(code: string) {
|
function isOverseaCode(code: string) {
|
||||||
return code[0] === '9';
|
return code[0] === '9';
|
||||||
@ -305,23 +323,14 @@ export default defineComponent({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Picker
|
<Picker
|
||||||
v-slots={pick(slots, ['title', 'columns-top', 'columns-bottom'])}
|
v-slots={pick(slots, INHERIT_SLOTS)}
|
||||||
ref={pickerRef}
|
ref={pickerRef}
|
||||||
class={bem()}
|
class={bem()}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
valueKey="name"
|
valueKey="name"
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
onConfirm={onConfirm}
|
onConfirm={onConfirm}
|
||||||
{...pick(props, [
|
{...pick(props, INHERIT_PROPS)}
|
||||||
'title',
|
|
||||||
'loading',
|
|
||||||
'readonly',
|
|
||||||
'itemHeight',
|
|
||||||
'swipeDuration',
|
|
||||||
'visibleItemCount',
|
|
||||||
'cancelButtonText',
|
|
||||||
'confirmButtonText',
|
|
||||||
])}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -147,11 +147,14 @@ An array that contains selected area objects.
|
|||||||
|
|
||||||
### Slots
|
### Slots
|
||||||
|
|
||||||
| Name | Description |
|
| Name | Description | SlotProps |
|
||||||
| -------------- | ---------------------------- |
|
| --------------- | ---------------------------- | --------- |
|
||||||
| title | Custom title |
|
| toolbar `3.1.2` | Custom toolbar content | - |
|
||||||
| columns-top | Custom content above columns |
|
| title | Custom title | - |
|
||||||
| columns-bottom | Custom content below columns |
|
| confirm `3.1.2` | Custom confirm button text | - |
|
||||||
|
| cancel `3.1.2` | Custom cancel button text | - |
|
||||||
|
| columns-top | Custom content above columns | - |
|
||||||
|
| columns-bottom | Custom content below columns | - |
|
||||||
|
|
||||||
### Methods
|
### Methods
|
||||||
|
|
||||||
|
@ -149,11 +149,14 @@ confirm 事件返回的数据整体为一个数组,数组每一项对应一列
|
|||||||
|
|
||||||
### Slots
|
### Slots
|
||||||
|
|
||||||
| 名称 | 说明 |
|
| 名称 | 说明 | 参数 |
|
||||||
| -------------- | ------------------ |
|
| ---------------- | ---------------------- | ---- |
|
||||||
| title | 自定义标题内容 |
|
| toolbar `v3.1.2` | 自定义整个顶部栏的内容 | - |
|
||||||
| columns-top | 自定义选项上方内容 |
|
| title | 自定义标题内容 | - |
|
||||||
| columns-bottom | 自定义选项下方内容 |
|
| confirm `v3.1.2` | 自定义确认按钮内容 | - |
|
||||||
|
| cancel `v3.1.2` | 自定义取消按钮内容 | - |
|
||||||
|
| columns-top | 自定义选项上方内容 | - |
|
||||||
|
| columns-bottom | 自定义选项下方内容 | - |
|
||||||
|
|
||||||
### 方法
|
### 方法
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user