From b4849707f7cd990a76061f4fa4bf71b66cae0f76 Mon Sep 17 00:00:00 2001 From: Cristiano Magro <cristiano.magro@vola.it> Date: Wed, 08 Jan 2025 13:01:02 +0100 Subject: [PATCH] v-model on Custom Components --- 11 - Forms/xno-forms-01-starting-setup/src/components/RatingControl.vue | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/11 - Forms/xno-forms-01-starting-setup/src/components/RatingControl.vue b/11 - Forms/xno-forms-01-starting-setup/src/components/RatingControl.vue index 8887c98..afdaeb6 100644 --- a/11 - Forms/xno-forms-01-starting-setup/src/components/RatingControl.vue +++ b/11 - Forms/xno-forms-01-starting-setup/src/components/RatingControl.vue @@ -13,14 +13,22 @@ </template> <script>export default { - data() { - return { - activeOption: null, - }; + props: ['modelValue'], + emits: ['update:modelValue'], + // data() { + // return { + // activeOption: null, + // }; + // }, + computed: { + activeOption(){ + return this.modelValue; + } }, methods: { activate(option) { - this.activeOption = option; + // this.activeOption = option; + this.$emit('update:modelValue', option); } } -- Gitblit v1.8.0