vue v-for循环生成节点,并获取索引对应的节点的值
//dom区<div v-for="(form,index) in formList" :key="index"><fm-generate-form:data="form":remote="remoteFuncs":value="editData"...
·
//dom区
<div v-for="(form,index) in formList" :key="index">
<fm-generate-form
:data="form"
:remote="remoteFuncs"
:value="editData"
:remote-option="dynamicData"
ref="generateForm"
>
</fm-generate-form>
<el-button type="primary" @click="handleSubmit(index)">下一步</el-button>
</div>
//方法区
methods: {
//todo 提交表单
handleSubmit (index) {
this.$refs.generateForm[index].getData().then(data => {
// Data verification succeeded
alert(JSON.stringify(data))
}).catch(e => {
// Data verification failed
})
},
}
加上索引
更多推荐
已为社区贡献11条内容
所有评论(0)