Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .github/dod.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/dod-checker.yml

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## @public-ui/[email protected] (2024-03-11)

#### :bug: Bug Fix

- fix(vue): v-model does not update when other events bubble up [#425](https://github.com/ionic-team/stencil-ds-output-targets/pull/425)

## @public-ui/[email protected] (2024-03-11)

#### :rocket: Enhancement
Expand Down
11 changes: 11 additions & 0 deletions packages/vue-output-target/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/vue-output-target/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@public-ui/stencil-vue-output-target",
"version": "0.9.0",
"version": "0.9.1",
"description": "Vue output target for @stencil/core components.",
"main": "dist/index.cjs.js",
"module": "dist/index.js",
Expand Down
13 changes: 11 additions & 2 deletions packages/vue-output-target/vue-component-lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,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);
}
});
});
},
Expand Down