vue select 获取value和lable操作

<el-form-item label="站点名称" prop="siteName">
            <el-select v-model="form.siteId"  @change="subStation" filterable  clearable placeholder="请选择">
                <el-option
                v-for="item in stationList"
                :key="item.id"
                :label="item.stationName"
                :value="item.id">
                </el-option>
            </el-select>
        </el-form-item>

步骤一:在select 控件里加入 @change事件

 methods: {
    /** 获取下拉值 */
    subStation(id){
        let obj = {};
        obj = this.stationList.find(item => {
            return item.id ===id 
        });
        console.log(obj.stationName);
        this.form.siteName = obj.stationName;
    },
}

步骤二:在方法里循环获取name值

上一篇:解决Nginx: [error] open() "/usr/local/Nginx/logs/Nginx.pid


下一篇:Java 创建xml文件和操作xml数据