Open Martin-Idel opened 1 year ago
Same here.
The examples in the docs doesn't bind either function. When I use v-on
, the input event from my component changes the model.
<template slot="custom-component" slot-scope="context">
<custom-component
v-bind="context"
v-on="context.on"
/>
</template>
Thanks for your input. I'll try that, too.
What I figured with my setup was that if I emitted both input
and change
at the same time, everything worked as expected. Only emitting one of the two - I never got any signal. No idea why that should be the case though...
Suppose you have the following (working) example with custom slots:
This works as expected: Changing the input element emits input signals on keystrokes and a
change
event on losing focus/enter which would change the model if so implemented.Now suppose that we change the type of the
list_section
toobject
(pretty much irrelevant) and<input :value="value" v-on="on" />
to<my-component :value="value" v-on="on" />
wheremy-component
is a custom Vue component. The component:this.$emit("change", newObj)
with the new object as part of the payload.Display works as expected: The component can show the model and is displayed as expected. On changing the model, the change event is correctly emitted from the
custom-component
, howevermyCustomChange
is never triggered. In other words: The changes in the custom component are never reflected back to the model.I noticed that this seems to be a specific problem with the
change
event. If I trigger theinput
event instead,myCustomInput
IS called. I also tried the following alternatives:<my-component :value="value" @change="on.change" />
<--my-component
emitschange
signal, but that doesn't trigger anything<my-component :value="value" @change="on.input" />
<--my-component
emitschange
signal which triggers input events and in the endmyCustomInput
.