< template >
<el-row>
<el-col :span="24" v-for="(item,index) in questions" :key="index" >
<el-select v-model="form[item.valueName]" placeholder="" size="small" style="width:150px;" @change="change">
<el-option
v-for="items in options"
:key="items.value"
:label="items.label"
:value="items.value">
</el-option>
</el-select>
</el-col>
</el-row>
< / template >
< script >
export default {
data() {
return {
questions: [
{
valueName: "value1"
},
{
valueName: "value2"
}],
options: [{
value: "1",
label: ""
}, {
value: "2",
label: ""
}, {
value: "3",
label: ""
}, {
value: "4",
label: ""
}, {
value: "5",
label: ""
}],
form: {}
}
},
created () {
this.form.value1 = "1"
this.form.value2 = "2"
},
methods: {
change() {
console.log(this.form)
}
}
}
< / script >