mirror of
https://github.com/youzan/vant.git
synced 2026-05-02 01:01:43 +08:00
[new feature] AddressList: support disabled list (#1729)
This commit is contained in:
@@ -15,6 +15,8 @@ Vue.use(AddressList);
|
||||
<van-address-list
|
||||
v-model="chosenAddressId"
|
||||
:list="list"
|
||||
:disabled-list="disabledList"
|
||||
disabled-text="以下地址超出配送范围"
|
||||
@add="onAdd"
|
||||
@edit="onEdit"
|
||||
/>
|
||||
@@ -38,6 +40,14 @@ export default {
|
||||
tel: '1310000000',
|
||||
address: '浙江省杭州市拱墅区莫干山路 50 号'
|
||||
}
|
||||
],
|
||||
disabledList: [
|
||||
{
|
||||
id: '3',
|
||||
name: '王五',
|
||||
tel: '1320000000',
|
||||
address: '浙江省杭州市滨江区江南大道 15 号'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -46,6 +56,7 @@ export default {
|
||||
onAdd() {
|
||||
Toast('新增地址');
|
||||
},
|
||||
|
||||
onEdit(item, index) {
|
||||
Toast('编辑地址:' + index);
|
||||
}
|
||||
@@ -58,17 +69,21 @@ export default {
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|-----------|-----------|-----------|-------------|
|
||||
| v-model | 当前选中地址的 id | String | - |
|
||||
| list | 地址列表 | Array | `[]` |
|
||||
| add-button-text | 底部按钮文字 | String | `新增地址` |
|
||||
| v-model | 当前选中地址的 id | `String` | - |
|
||||
| list | 地址列表 | `Array` | `[]` |
|
||||
| disabled-list | 不可配送地址列表 | `Array` | `[]` |
|
||||
| disabled-text | 不可配送提示文案 | `String` | - |
|
||||
| add-button-text | 底部按钮文字 | `String` | `新增地址` |
|
||||
|
||||
### Event
|
||||
|
||||
| 事件名 | 说明 | 参数 |
|
||||
|-----------|-----------|-----------|
|
||||
| add | 点击新增按钮时触发 | - |
|
||||
| edit | 点击编辑按钮时触发 | item: 当前地址对象,index: 索引 |
|
||||
| select | 切换选中的地址时触发 | item: 当前地址对象,index: 索引 |
|
||||
| edit | 点击编辑按钮时触发 | item: 地址对象,index: 索引 |
|
||||
| select | 切换选中的地址时触发 | item: 地址对象,index: 索引 |
|
||||
| edit-disabled | 编辑不可配送的地址时触发 | item: 地址对象,index: 索引 |
|
||||
| select-disabled | 选中不可配送的地址时触发 | item: 地址对象,index: 索引 |
|
||||
|
||||
### 数据格式
|
||||
|
||||
|
||||
Reference in New Issue
Block a user