[new feature] Area: reset method support code param

This commit is contained in:
陈嘉涵 2019-05-27 10:27:18 +08:00
parent 80a7b7cae9
commit 73f34be3a8
9 changed files with 17 additions and 16 deletions

View File

@ -36,10 +36,10 @@
## Install ## Install
```bash ```bash
# install vant 1.x # install 1.x stable
npm i vant -S npm i vant -S
# install vant 2.0 beta # install 2.0 beta
npm i vant@beta -S npm i vant@beta -S
``` ```

View File

@ -35,10 +35,10 @@
## 安装 ## 安装
```bash ```bash
# 安装 vant 1.x 稳定版本 # 安装 1.x 稳定版本
npm i vant -S npm i vant -S
# 安装 vant 2.0 测试版本 # 安装 2.0 测试版本
npm i vant@beta -S npm i vant@beta -S
``` ```

View File

@ -16,6 +16,10 @@
- DropdownMenu - DropdownMenu
- NumberKeyboard - NumberKeyboard
##### Area
- 支持`reset`方法传入`code`参数
##### ImagePreview ##### ImagePreview
- 新增`close-on-popstate`属性 - 新增`close-on-popstate`属性

View File

@ -22,10 +22,10 @@ In the GUI, click on 'Dependencies' -> `Install Dependencies` and add `vant` to
### Install ### Install
```bash ```bash
# install vant 1.x # install 1.x stable
npm i vant -S npm i vant -S
# install vant 2.0 beta # install 2.0 beta
npm i vant@beta -S npm i vant@beta -S
``` ```

View File

@ -31,10 +31,10 @@ vue ui
### 安装 ### 安装
```bash ```bash
# 安装 vant 1.x 稳定版本 # 安装 1.x 稳定版本
npm i vant -S npm i vant -S
# 安装 vant 2.0 测试版本 # 安装 2.0 测试版本
npm i vant@beta -S npm i vant@beta -S
``` ```

View File

@ -1,10 +1,7 @@
<template> <template>
<demo-section> <demo-section>
<demo-block :title="$t('basicUsage')"> <demo-block :title="$t('basicUsage')">
<van-area <van-area :area-list="$t('areaList')" />
ref="area"
:area-list="$t('areaList')"
/>
</demo-block> </demo-block>
<demo-block :title="$t('title2')"> <demo-block :title="$t('title2')">

View File

@ -69,7 +69,7 @@ Use ref to get area instance and call instance methods
| Name | Attribute | Return value | Description | | Name | Attribute | Return value | Description |
|------|------|------|------| |------|------|------|------|
| reset | - | - | Reset all options | | reset | code: string | - | Reset all options by code |
### areaList Data Structure ### areaList Data Structure

View File

@ -171,8 +171,8 @@ export default sfc({
return area; return area;
}, },
reset() { reset(code) {
this.code = ''; this.code = code || '';
this.setValues(); this.setValues();
} }
}, },

View File

@ -68,7 +68,7 @@ Vue.use(Area);
| 方法名 | 参数 | 返回值 | 介绍 | | 方法名 | 参数 | 返回值 | 介绍 |
|------|------|------|------| |------|------|------|------|
| reset | - | - | 重置所有选项到第一项 | | reset | code: string | - | 根据 code 重置所有选项,若不传 code则重置到第一项 |
### 省市区列表数据格式 ### 省市区列表数据格式