types(Field): add focus、blur method type

This commit is contained in:
陈嘉涵 2019-12-22 17:13:33 +08:00 committed by neverland
parent 5c1883f77c
commit 0b5c8e5f3d
3 changed files with 12 additions and 2 deletions

View File

@ -83,12 +83,14 @@ export default createComponent({
},
methods: {
// @exposed-api
focus() {
if (this.$refs.input) {
this.$refs.input.focus();
}
},
// @exposed-api
blur() {
if (this.$refs.input) {
this.$refs.input.blur();

6
types/field.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
import { VanComponent } from './component';
export class Field extends VanComponent {
focus(): void;
blur(): void;
}

6
types/index.d.ts vendored
View File

@ -6,6 +6,8 @@ import { Checkbox } from './checkbox';
import { CheckboxGroup } from './checkbox-group';
import { CountDown } from './count-down';
import { Dialog } from './dialog';
import { DropdownItem } from './dropdown-item';
import { Field } from './field';
import { ImagePreview } from './image-preview';
import { Lazyload } from './lazyload';
import { Locale } from './locale';
@ -31,9 +33,7 @@ export class CouponCell extends VanComponent {}
export class CouponList extends VanComponent {}
export class DatetimePicker extends VanComponent {}
export class Divider extends VanComponent {}
export class DropdownItem extends VanComponent {}
export class DropdownMenu extends VanComponent {}
export class Field extends VanComponent {}
export class Grid extends VanComponent {}
export class GridItem extends VanComponent {}
export class GoodsAction extends VanComponent {}
@ -92,6 +92,8 @@ export {
CheckboxGroup,
CountDown,
Dialog,
DropdownItem,
Field,
ImagePreview,
Lazyload,
Locale,