如何获取级联选择器选中的值

今天遇到了一个级联选择器的问题:如何将选中的值反馈给后端。
问题已解决:亲测有效,成功
查资料的结果:

*this.$ref[‘cascaderAddr’].getcasederNodes[0].label

*this.$ref[‘cascaderAddr’].getcasederNodes

*this.$ref[‘cascaderAddr’].getcasederNodes[0].label ---------//getcasederNodes用了后,控制台报错:说getcasederNodes没有被定义,开始我还想那应该只需调用,结果给了我一巴掌

*this.$refs.cascaderAddr.currentLabels[i]
cascaderAddr这个还需要去注册
在这里插入图片描述
里面有些数据是没有完全展示出来,抱歉,由于岗位原因,大家应该都知道这个梗

在这里插入图片描述当时遇到的是sub_org为空(undefined),查了半天的资料,结果发现自己没有加接参的属性值value

在props中加入value这个属性,其对应你要给后端反馈该值的那个属性
在这里插入图片描述注意:这里的value对应着事件中携带的数据value


<el-col :span="4">
    <el-form-item prop="two_institutions" :rules="[{ required:false,message:'管理机构不能为空',trigger:'blur' }]">
        <el-cascader style="width:480px;" v-model="userForm.two_institutions" :options="options_two" :props="{ expandTrigger: 'hover',value:'id' }" :show-all-levels="true" clearable @change="handleChange" ></el-cascader>
    </el-form-item>
</el-col>
methods函数事件:

handleChange(value){
            this.$http.get('api/user/seekorg/').then(res => {
                ++this.cascaderKey
                this.optionsList = res.data.source
                this.options_two = res.data.source
            }).catch(err =>{

            })
        },  //该函数主要是把后端获取的值赋给级联选择器

//新增事件
        Add(){
            // const token = sessionStorage.token
            const params = {
                // headers:{ 'Authorization': sessionStorage.token },
                name:this.userForm.name,   //用户名
                phone_num:this.userForm.phone,
                role_type:this.userForm.usertwo,           //角色
                role_name:this.userForm.usertwo1,     //角色类型
                password:this.userForm.password,
                user_code:'',
                username:'',
                sub_org:this.userForm.institutions,   //调动机构
                manage_org:this.userForm.two_institutions,    //管理机构
            }
            console.log(params)
            this.$http.post('/api/user/register/',params).then( resp => {
                console.info(resp.data)
                if(resp.data.msg === 200){
                    this.$message.success('添加成功')
                    this.$message.info(res.data.msg)
                }
            }).catch(err => {
                this.$message.error(err)
            })
        },   //添加事件

总结:快速解决,注意红色框中value属性是确定唯一标识