diff --git a/src/area/README.md b/src/area/README.md index 9a7ddfbee..9ba790bd7 100644 --- a/src/area/README.md +++ b/src/area/README.md @@ -85,7 +85,7 @@ Use [ref](https://vuejs.org/v2/api/#ref) to get Area instance and call instance | Name | Description | Attribute | Return value | |------|------|------|------| -| reset | Reset all options by code | code: string | - | +| reset | Reset all options by code | code?: string | - | ### areaList Data Structure diff --git a/src/area/README.zh-CN.md b/src/area/README.zh-CN.md index 3d9a82c10..e16850c1d 100644 --- a/src/area/README.zh-CN.md +++ b/src/area/README.zh-CN.md @@ -84,7 +84,7 @@ Vue.use(Area); | 方法名 | 说明 | 参数 | 返回值 | |------|------|------|------| -| reset | 根据 code 重置所有选项,若不传 code,则重置到第一项 | code: string | - | +| reset | 根据 code 重置所有选项,若不传 code,则重置到第一项 | code?: string | - | ### 省市区列表数据格式 diff --git a/src/area/index.js b/src/area/index.js index 1783b0071..b2d1940dd 100644 --- a/src/area/index.js +++ b/src/area/index.js @@ -262,6 +262,7 @@ export default createComponent({ return area; }, + // @exposed-api reset(code) { this.code = code || ''; this.setValues(); diff --git a/types/area.d.ts b/types/area.d.ts new file mode 100644 index 000000000..61dfc4aac --- /dev/null +++ b/types/area.d.ts @@ -0,0 +1,5 @@ +import { VanComponent } from './component'; + +export class Area extends VanComponent { + reset(code?: string): void; +} diff --git a/types/index.d.ts b/types/index.d.ts index 1faf69f55..923e4eccd 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,5 +1,7 @@ import Vue from 'vue'; import { VanComponent } from './component'; +import { AddressEdit } from './address-edit'; +import { Area } from './area'; import { Toast } from './toast'; import { Dialog } from './dialog'; import { Notify } from './notify'; @@ -8,11 +10,9 @@ import { Lazyload } from './lazyload'; import { ImagePreview } from './image-preview'; export const version: string; -export function install (vue: typeof Vue): void +export function install(vue: typeof Vue): void; export class ActionSheet extends VanComponent {} - export class AddressList extends VanComponent {} -export class Area extends VanComponent {} export class Button extends VanComponent {} export class Card extends VanComponent {} export class Cell extends VanComponent {} @@ -86,10 +86,12 @@ export class TreeSelect extends VanComponent {} export class Uploader extends VanComponent {} export { - Toast, + AddressEdit, + Area, Dialog, - Notify, - Locale, + ImagePreview, Lazyload, - ImagePreview + Locale, + Notify, + Toast };