feat(AddressList): add new right-icon props (#11959)

This commit is contained in:
ShuGang Zhou 2023-06-11 11:29:27 +08:00 committed by GitHub
parent 803b471dbd
commit 97fa5301fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 10 deletions

View File

@ -6,6 +6,7 @@ import {
numericProp, numericProp,
makeArrayProp, makeArrayProp,
createNamespace, createNamespace,
makeStringProp,
} from '../utils'; } from '../utils';
// Components // Components
@ -23,6 +24,7 @@ export const addressListProps = {
disabledList: makeArrayProp<AddressListAddress>(), disabledList: makeArrayProp<AddressListAddress>(),
addButtonText: String, addButtonText: String,
defaultTagText: String, defaultTagText: String,
rightIcon: makeStringProp('edit'),
}; };
export type AddressListProps = ExtractPropTypes<typeof addressListProps>; export type AddressListProps = ExtractPropTypes<typeof addressListProps>;
@ -72,6 +74,7 @@ export default defineComponent({
disabled={disabled} disabled={disabled}
switchable={props.switchable} switchable={props.switchable}
defaultTagText={props.defaultTagText} defaultTagText={props.defaultTagText}
rightIcon={props.rightIcon}
onEdit={onEdit} onEdit={onEdit}
onClick={onClick} onClick={onClick}
onSelect={onSelect} onSelect={onSelect}

View File

@ -6,6 +6,7 @@ import {
createNamespace, createNamespace,
makeRequiredProp, makeRequiredProp,
type Numeric, type Numeric,
makeStringProp,
} from '../utils'; } from '../utils';
// Components // Components
@ -32,6 +33,7 @@ export default defineComponent({
disabled: Boolean, disabled: Boolean,
switchable: Boolean, switchable: Boolean,
defaultTagText: String, defaultTagText: String,
rightIcon: makeStringProp('edit'),
}, },
emits: ['edit', 'click', 'select'], emits: ['edit', 'click', 'select'],
@ -46,7 +48,7 @@ export default defineComponent({
const renderRightIcon = () => ( const renderRightIcon = () => (
<Icon <Icon
name="edit" name={props.rightIcon}
class={bem('edit')} class={bem('edit')}
onClick={(event) => { onClick={(event) => {
event.stopPropagation(); event.stopPropagation();

View File

@ -90,6 +90,7 @@ export default {
| switchable | Whether to allow switch address | _boolean_ | `true` | | switchable | Whether to allow switch address | _boolean_ | `true` |
| add-button-text | Add button text | _string_ | `Add new address` | | add-button-text | Add button text | _string_ | `Add new address` |
| default-tag-text | Default tag text | _string_ | - | | default-tag-text | Default tag text | _string_ | - |
| right-icon `v4.4.2` | Right Icon | _string_ | `edit` |
### Events ### Events

View File

@ -81,15 +81,16 @@ export default {
### Props ### Props
| 参数 | 说明 | 类型 | 默认值 | | 参数 | 说明 | 类型 | 默认值 |
| ---------------- | ----------------- | ---------------------- | ---------- | | --- | --- | --- | --- |
| v-model | 当前选中地址的 id | _number \| string_ | - | | v-model | 当前选中地址的 id | _number \| string_ | - |
| list | 地址列表 | _AddressListAddress[]_ | `[]` | | list | 地址列表 | _AddressListAddress[]_ | `[]` |
| disabled-list | 不可配送地址列表 | _AddressListAddress[]_ | `[]` | | disabled-list | 不可配送地址列表 | _AddressListAddress[]_ | `[]` |
| disabled-text | 不可配送提示文案 | _string_ | - | | disabled-text | 不可配送提示文案 | _string_ | - |
| switchable | 是否允许切换地址 | _boolean_ | `true` | | switchable | 是否允许切换地址 | _boolean_ | `true` |
| add-button-text | 底部按钮文字 | _string_ | `新增地址` | | add-button-text | 底部按钮文字 | _string_ | `新增地址` |
| default-tag-text | 默认地址标签文字 | _string_ | - | | default-tag-text | 默认地址标签文字 | _string_ | - |
| right-icon `v4.4.2` | 右侧图标名称或图片链接,等同于 Icon 组件的 [name 属性](#/zh-CN/icon#props) | _string_ | `edit` |
### Events ### Events