V模型在ant design输入组件vue 3中不起作用

Wis*_*nda 1 javascript vue.js antd vuejs3 antdv

我正在使用 vue 3 和 ant design 2x。我厌倦了尝试这段代码。而且我在关注 vue 文档时,感觉有些遗漏。我被这个问题困扰了。我希望你能得出结论。

           <a-form
               :model="form"
               @submit="handleSubmit"
           >
               <a-form-item class="mb-10">
                   <a-input
                       type="text"
                       v-model="form.name"
                       placeholder="Name"
                   >   
                   </a-input>
                   <a-button type="primary" block html-type="submit">
                       SUBMIT
                   </a-button>
           <a-form>

Run Code Online (Sandbox Code Playgroud)

在此先感谢您的帮助。

Wis*_*nda 5

经过大量时间的研究,我从 ant 文档中的 antv 示例中得到了解决方案。我像这样更新代码。不同的是我更新 v-model="form.name"v-model:value="form.name"

           <a-form
           :model="form"
           @submit="handleSubmit"
        >
           <a-form-item class="mb-10">
               <a-input
                   type="text"
                   v-model:value="form.name"
                   placeholder="Name"
                 >   
               </a-input>
               <a-button type="primary" block html-type="submit">
                   SUBMIT
               </a-button>
       <a-form>
Run Code Online (Sandbox Code Playgroud)