types(Area): add reset method type (#5353)

This commit is contained in:
neverland 2019-12-22 12:54:29 +08:00 committed by GitHub
parent a54a77d8c8
commit 24def10a1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 9 deletions

View File

@ -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

View File

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

View File

@ -262,6 +262,7 @@ export default createComponent({
return area;
},
// @exposed-api
reset(code) {
this.code = code || '';
this.setValues();

5
types/area.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
import { VanComponent } from './component';
export class Area extends VanComponent {
reset(code?: string): void;
}

16
types/index.d.ts vendored
View File

@ -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
};