当前位置: 首页> 房产> 建筑 > 【el-cascader 多级多选限制条数】

【el-cascader 多级多选限制条数】

时间:2025/7/11 23:49:16来源:https://blog.csdn.net/weixin_47416539/article/details/139993747 浏览次数:0次
<el-cascaderref="cascaderJob"v-if="categoryjobOptions.length > 0"class="el_input_widht"v-model="categoryjobValue"placeholder="职位分类":options="categoryjobOptions":props="{multiple: true, checkStrictly: true}":show-all-levels="true"@change="categoryjobChange"
></el-cascader>
categoryjobChange(val){
if(val.length>2){this.categoryjobOptions = this.DisabledForStatus(this.categoryjobOptions,1)this.categoryjobOptions.forEach(element => {val.forEach(item => {if(item.length==1){if(item[0] == element.value){element.disabled = false;}}else if(item.length==2){element.children.forEach(it => {if(it.value==item[1]){it.disabled = false;}});}else if(item.length==3){element.children.forEach(it => {if(it.value==item[1]){it.children.forEach(t => {if(t.value==item[2]){t.disabled = false;}});}});}});});}else{this.categoryjobOptions = this.DisabledForStatus(this.categoryjobOptions,2)}
},DisabledForStatus(arr,type) {let newArr = JSON.parse(JSON.stringify(arr));newArr.forEach((item) => {if(type==1){item.disabled = true;}else{item.disabled = false;}// 有无children项if (item.children && item.children.length !== 0) {let newChildren = [];newChildren = this.addDisabledForStatus(item.children,type);item.children = newChildren;}});return newArr;},
关键字:【el-cascader 多级多选限制条数】

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: