Fixed #1748 - New change event for SelectButton

pull/1751/head
Tuğçe Küçükoğlu 2021-11-12 16:10:50 +03:00
parent f2b9b8dd38
commit 3d343c9cdd
4 changed files with 25 additions and 1 deletions

View File

@ -56,6 +56,22 @@ const SelectButtonProps = [
];
const SelectButtonEvents = [
{
name: "change",
description: "Callback to invoke on value change.",
arguments: [
{
name: "event.originalEvent",
type: "object",
description: "Browser event"
},
{
name: "event.value",
type: "any",
description: "Single value or an array of values that are selected."
}
]
},
{
name: "focus",
description: "Callback to invoke on focus.",

View File

@ -18,6 +18,7 @@ interface SelectButtonOptionSlotInterface {
declare class SelectButton {
$props: SelectButtonProps;
$emit(eventName: 'update:modelValue', value: any): this;
$emit(eventName: 'change', event: {originalEvent: Event, value: any}): this;
$emit(eventName: 'focus', event: Event): this;
$emit(eventName: 'blur', event: Event): this;
$slots: {

View File

@ -17,7 +17,7 @@ import Ripple from 'primevue/ripple';
export default {
name: 'SelectButton',
emits: ['update:modelValue', 'focus', 'blur'],
emits: ['update:modelValue', 'focus', 'blur', 'change'],
props: {
modelValue: null,
options: Array,
@ -62,6 +62,7 @@ export default {
}
this.$emit('update:modelValue', newValue);
this.$emit('change', {event: event, value: newValue});
},
isSelected(option) {
let selected = false;

View File

@ -139,6 +139,12 @@ export default {
</tr>
</thead>
<tbody>
<tr>
<td>change</td>
<td>event.originalEvent: browser event <br>
event.value: Single value or an array of values that are selected.</td>
<td>Callback to invoke on value change.</td>
</tr>
<tr>
<td>focus</td>
<td>event: Browser event</td>