Skip to content

Commit

Permalink
add onchange event
Browse files Browse the repository at this point in the history
  • Loading branch information
pmpc94 committed Nov 13, 2023
1 parent bd8411a commit 42a7831
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

*
* `onChange` event to input component - [#646](https://github.com/ripe-tech/ripe-components-vue/issues/646)

### Changed

Expand Down
8 changes: 7 additions & 1 deletion vue/components/ui/atoms/input/input.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,16 @@ storiesOf("Components/Atoms/Input", module)
default: number("Max Length", null)
}
},
data: function() {
data: function () {
return {
valueData: this.value
};
},
methods: {
onChange(value) {
console.log(value);
}
},
watch: {
value(value) {
this.valueData = value;
Expand All @@ -102,6 +107,7 @@ storiesOf("Components/Atoms/Input", module)
v-bind:min-width="minWidth"
v-bind:height="height"
v-bind:debounce-delay="debounceDelay"
v-on:change="onChange"
v-bind:max-length="maxLength" />
</form-input>
<p>Text: {{ valueData }}</p>
Expand Down
4 changes: 4 additions & 0 deletions vue/components/ui/atoms/input/input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
v-on:blur="onBlur"
v-on:keyup="onKeyup"
v-on:keydown="onKeydown"
v-on:change="onChange"
/>
</template>

Expand Down Expand Up @@ -198,6 +199,9 @@ export const Input = {
onClick(event) {
this.$emit("click", event);
},
onChange(event) {
this.$emit("change", event);
},
onFocus(event) {
this.$emit("focus", event);
},
Expand Down

0 comments on commit 42a7831

Please sign in to comment.