<div id="app">
<el-card style="width: 300px">
<el-form label-position="top" size="mini">
<el-form-item label="标题">
<el-input></el-input>
</el-form-item>
<el-form-item v-for="item in questions" :key="item.id" :label="item.label">
<el-radio-group v-model="item.check">
<el-radio v-for="it in item.options" :key="'uni_'+item.id+'_'+it.value" :label="'uni_'+item.id+'_'+it.value">{{ it.key }}</el-radio>
</el-radio-group>
</el-form-item>
<el-button type="primary" @click="submit">提交</el-button>
</el-form>
</el-card>
</div>
<script>
let vue = new Vue({
el: '#app',
data: () => {
return {
form: {
radioGroup: ''
},
questions: [
{
label: '您的性别?', id: 1, options: [{key: '男', value: 1}, {key: '女', value: 0}]
},
{
label: '您的婚姻状况是?', id: 2, options: [{key: '未婚', value: 0}, {key: '已婚', value: 1}]
}
]
}
},
methods: {
submit() {
console.log(this.questions)
}
}
})
</script>
文章来源地址https://www.toymoban.com/news/detail-675008.html
文章来源:https://www.toymoban.com/news/detail-675008.html
到了这里,关于Vue&elementui动态渲染Radio,Checkbox,笔记的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!