(vue)el-cascader实现多选最后一级并回显
< el- form- item label= "选择算法模型:" > < el- cascaderv- model= "formInline.algorithmId" : options= "modelOptions" : props= "{ value: 'id', label: 'name', multiple: true, emitPath: false,}" filterableclearableplaceholder= "请选择" style= "width: 430px;" @change= "modelChange" > < template slot- scope= "{ node, data }" > < span> { { data. name } } < / span> < span v- if = "!node.isLeaf" > ( { { data. children. length } } ) < / span> < / template> < / el- cascader>
< / el- form- item>
modelChange ( val) { console. log ( "算法模型改变" ) ; console. log ( val) ;
} ,
拓展:单选只取最后一级
< el- form- item label= "工序" > < el- cascaderv- model= "formInline.processId" : options= "processOptions" : props= "{ value: 'id', label: 'name' }" : show- all- levels= "false" @change= "ziduanSearch" > < / el- cascader>
< / el- form- item>
ziduanSearch ( val) { this. formInline. processId = val[ val. length - 1 ] ;
} ,