sonicoder86 / todomvc-vue-composition-api

TodoMVC built with Vue 3 Composition Api and Vuex

Home Page:https://blacksonic.github.io/todomvc-vue-composition-api/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Do you have an v-model example?

yooouuri opened this issue · comments

I am trying the new Composition API but I am not getting v-model on a custom component working...

<custom-component v-model="something"></custom-component>

Inside the custom component, I have a prop called value and a watcher on the prop. But the watcher doesn't trigger..

export default {
        props: {
            value: Boolean,
        },
watch(props.value, (value, value2) => {
                console.info(value);
                console.info(value2);
            });

Hi,

Does it mean it passes down a prop from parent to a child with the name value and this value should change when the parent component modifies the something variable?
I haven't tried it myself yet. If it's not working I would raise a ticket in the vue-next repository. They are really helpful.

I meant just like: https://alligator.io/vuejs/add-v-model-support/

But then use the new Composition API