/vue_model_volar_error_sample

vue 2 (& model) + volar -> error sample

Primary LanguageVueMIT LicenseMIT

vue 2 (& model) + volar -> error sample

problem

script setup + vue2 + export default { model } + vue-tsc not supoort.

  • add props and emits
type Props = {
    inputValue: boolean;
};
const props = defineProps<Props>();
const emits = defineEmits<{
    (name:"change", value:boolean):void
}>()
  • add export default model
export default {
    model: {
        prop: "inputValue",
        event: "change",
    },
}
  • use v-model
<checkbox-sample v-model="checked" />

error

  • vue 2.6

vue2.6 v-model error

  • vue 2.7

vue2.7 v-model error

conclusion

→ vue2 + volar is alternate v-model is not support (v-bind:value and v-on:input only support. (vue2