第一种: 获取选中的最后一级的子节点
this.$refs['自定义的ref名字'].getCheckedNodes()[0].label
第二种:获取选中的所有节点的路径
this.$refs['自定义的ref名字'].getCheckedNodes()[0].pathLabels
例子:
<el-cascader
class="custom-width"
filterable
clearable
ref="refSubCat"
v-model="personForm.orgGuid"
:options="departmentSelect"
@change="handleSubCat"
placeholder="请选择部门"
:props="{
value: 'guid',
label: 'name',
children: 'childrens',
checkStrictly: true
}"
></el-cascader>
handleSubCat(){
// 获取选中的最后一级的子节点
// 格式:产品组
this.$refs['refSubCat'].getCheckedNodes()[0].label
// 获取选中的所有节点的路径,并且用join()方法分割转换为字符串
// 格式:某某公司/信息技术中心/信息技术部/产品组
this.$refs['refSubCat'].getCheckedNodes()[0].pathLabels.join('/')
}
附上原图: