<div class="block">
<span class="demonstration">默认 click 触发子菜单</span>
<el-cascader
ref="cascaderAddr"
v-model="value"
:options="options"
@change="handleChange"
></el-cascader>
</div>
?
handleChange(value) {
console.log(value);
let nodeContent = this.$refs["cascaderAddr"].getCheckedNodes();
// 这种方式
// if (this.value.length != 0) {
// let arr = this.$refs['cascaderAddr'].getCheckedNodes()[0].pathLabels
// console.log('value', this.value)
// console.log('arr', arr)
// }
//这种方式
this.$nextTick(() => {
let casename = this.$refs["cascaderAddr"].presentText.split(
this.$refs["cascaderAddr"].separator
);
console.log("value:", casename);
});
// console.log(this.$refs['cascaderAddr'].getCheckedNodes())
},
|