mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-17 10:41:13 +08:00
Merge branch 'next' into ROU-4848
This commit is contained in:
@ -218,6 +218,8 @@ export const IonCheckbox = /*@__PURE__*/ defineContainer<JSX.IonCheckbox, JSX.Io
|
||||
'labelPlacement',
|
||||
'justify',
|
||||
'alignment',
|
||||
'size',
|
||||
'shape',
|
||||
'ionChange',
|
||||
'ionFocus',
|
||||
'ionBlur'
|
||||
@ -228,7 +230,8 @@ export const IonCheckbox = /*@__PURE__*/ defineContainer<JSX.IonCheckbox, JSX.Io
|
||||
export const IonChip = /*@__PURE__*/ defineContainer<JSX.IonChip>('ion-chip', defineIonChip, [
|
||||
'color',
|
||||
'outline',
|
||||
'disabled'
|
||||
'disabled',
|
||||
'shape'
|
||||
]);
|
||||
|
||||
|
||||
|
@ -91,8 +91,17 @@ export const defineContainer = <Props, VModelType = string | number | boolean>(
|
||||
const eventsNames = Array.isArray(modelUpdateEvent) ? modelUpdateEvent : [modelUpdateEvent];
|
||||
eventsNames.forEach((eventName: string) => {
|
||||
el.addEventListener(eventName.toLowerCase(), (e: Event) => {
|
||||
modelPropValue = (e?.target as any)[modelProp];
|
||||
emit(UPDATE_VALUE_EVENT, modelPropValue);
|
||||
/**
|
||||
* Only update the v-model binding if the event's target is the element we are
|
||||
* listening on. For example, Component A could emit ionChange, but it could also
|
||||
* have a descendant Component B that also emits ionChange. We only want to update
|
||||
* the v-model for Component A when ionChange originates from that element and not
|
||||
* when ionChange bubbles up from Component B.
|
||||
*/
|
||||
if (e.target.tagName === el.tagName) {
|
||||
modelPropValue = (e?.target as any)[modelProp];
|
||||
emit(UPDATE_VALUE_EVENT, modelPropValue);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
Reference in New Issue
Block a user