审查视图

public/assets/libs/eonasdan-bootstrap-datetimepicker/docs/Events.md 1.6 KB
郭盛 authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
## Events

### dp.hide

Fired when the widget is hidden.

Parameters:

```
e = {
    date //the currently set date. Type: moment object (clone)
}
```

Emitted from:

* toggle()
* hide()
* disable()

----------------------

### dp.show

Fired when the widget is shown.

Parameters:

No parameters are include, listen to `dp.change` instead

Emitted from:

* toggle()
* show()

----------------------

### dp.change

Fired when the date is changed, including when changed to a non-date (e.g. When keepInvalid=true).

Parameters:

```
e = {
    date, //date the picker changed to. Type: moment object (clone)
    oldDate //previous date. Type: moment object (clone) or false in the event of a null
}
```

Emitted from:

* toggle() **Note**: Only fired when using `useCurrent`
* show() **Note**: Only fired when using `useCurrent` or when or the date is changed to comply with date rules (min/max etc)
* date(newDate)
* minDate(minDate)
* maxDate(maxDate)
* daysOfWeekDisabled()

----------------------

### dp.error

Fired when a selected date fails to pass validation.

Parameters:

```
e = {
    date //the invalid date. Type: moment object (clone)
    oldDate //previous date. Type: moment object (clone) or false in the event of a null
}
```

Emmited from:

* minDate(minDate)
* maxDate(maxDate)
* daysOfWeekDisabled()
* setValue() *private function*

----------------------

### dp.update

<small>4.14.30</small>

Fired (in most cases) when the `viewDate` changes. E.g. Next and Previous buttons, selecting a year.

Parameters:

```
e = {
   change, //Change type as a momentjs format token. Type: string e.g. yyyy on year change
   viewDate //new viewDate. Type: moment object
}
```