types(Checkbox): add toggle method type (#5354)

This commit is contained in:
neverland 2019-12-22 13:03:25 +08:00 committed by GitHub
parent 24def10a1e
commit 216ca56e63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 8 deletions

View File

@ -232,7 +232,7 @@ export default {
| 方法名 | 说明 | 参数 | 返回值 |
|------|------|------|------|
| toggleAll | 切换所有复选框的选中状态 | checked?: boolean | - |
| toggleAll | 切换所有复选框,传`true`为选中,`false`为取消选中,不传参为取反 | checked?: boolean | - |
### Checkbox 方法
@ -240,4 +240,4 @@ export default {
| 方法名 | 说明 | 参数 | 返回值 |
|------|------|------|------|
| toggle | 切换选中状态 | checked?: boolean | - |
| toggle | 切换选中状态,传`true`为选中,`false`为取消选中,不传参为取反 | checked?: boolean | - |

View File

@ -33,6 +33,7 @@ export default createComponent({
},
methods: {
// @exposed-api
toggle(checked = !this.checked) {
// When toggle method is called multiple times at the same time,
// only the last call is valid.

5
types/checkbox-group.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
import { VanComponent } from './component';
export class CheckboxGroup extends VanComponent {
toggleAll(checked?: boolean): void;
}

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

@ -0,0 +1,5 @@
import { VanComponent } from './component';
export class Checkbox extends VanComponent {
toggle(checked?: boolean): void;
}

14
types/index.d.ts vendored
View File

@ -2,12 +2,14 @@ import Vue from 'vue';
import { VanComponent } from './component';
import { AddressEdit } from './address-edit';
import { Area } from './area';
import { Toast } from './toast';
import { Checkbox } from './checkbox';
import { CheckboxGroup } from './checkbox-group';
import { Dialog } from './dialog';
import { Notify } from './notify';
import { Locale } from './locale';
import { Lazyload } from './lazyload';
import { ImagePreview } from './image-preview';
import { Lazyload } from './lazyload';
import { Locale } from './locale';
import { Notify } from './notify';
import { Toast } from './toast';
export const version: string;
export function install(vue: typeof Vue): void;
@ -20,8 +22,6 @@ export class CellGroup extends VanComponent {}
export class CountDown extends VanComponent {}
export class Divider extends VanComponent {}
export class SwipeCell extends VanComponent {}
export class Checkbox extends VanComponent {}
export class CheckboxGroup extends VanComponent {}
export class Circle extends VanComponent {}
export class Col extends VanComponent {}
export class Collapse extends VanComponent {}
@ -88,6 +88,8 @@ export class Uploader extends VanComponent {}
export {
AddressEdit,
Area,
Checkbox,
CheckboxGroup,
Dialog,
ImagePreview,
Lazyload,