Cannot combine @Watch with @Emit
scscgit opened this issue · 3 comments
Repro: https://stackblitz.com/edit/vitejs-vite-t3ipir?file=src%2Fcomponents%2FCounter.vue
In vue-class-component + vue-property-decorator, I was able to use a following combination of decorators:
@Emit()
@Watch('value', { immediate: true })
watchValue(value) {
return value;
}
It caused the emit both initially (due to immediate
) and after each change of the watched variable. In vue-facing-decorator, the @Watch
doesn't trigger the @Emit
.
@scscgit Just a note that your stackblitz repro is erroring for me, but I added a tsconfig.json
file with
{
"compilerOptions": {
"experimentalDecorators": true
}
}
and then it worked. The issue you're describing is definitely evident in that repro by clicking the "Increment" div and seeing that the count doesn't increment (unless the "Emit" div is also clicked)
@alecgibson Would you like to resolve some issues?
It doesn't support to combine decorators on one field at the moment.