After the elementui loop el-select, initializes the value, select it again. The value changes in js, but not in the presentation.

< 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 >

Apr.07,2021

vue cannot listen for changes to dynamically added properties. You need to use $set to assign values to these properties.

  

I have some good news for you. Vue2.9 the bug has been officially solved! ("") y

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea9348-1f35.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea9348-1f35.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?