简体   繁体   English

使用vue.js绑定动态表单值

[英]Binding dynamic form values with vue.js

I've built a dynamic set of form inputs using vue.js , where the form inputs are generated from an external list of inputs. 我使用vue.js构建了一组动态表单输入,其中表单输入是从外部输入列表生成的。

My problem is that I don't see how I can bind the input values back to the vue model, so that the vue instance can access / interact with the form values. 我的问题是我没有看到如何将输入值绑定回vue模型,因此vue实例可以访问/与表单值交互。

I've created a basic fiddle to give you the idea here: https://jsfiddle.net/gzprj5ef/ 我创建了一个基本的小提琴,在这里给你的想法: https//jsfiddle.net/gzprj5ef/

Is it possible to update the vue instance with the form values? 是否可以使用表单值更新vue实例?

You have to remove double brackets when you are using v-model . 使用v-model时,必须删除双括号。

Here is the updated jsfiddle 这是更新的jsfiddle

您可以使用v-model =“input.value”,并且可以在变量“inputs”中获取结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM