根據(jù)官方文檔的props下的disabled設(shè)置
官方文檔
模板
<template>
<el-tree :data="dataList"
node-key="id"
show-checkbox
:props="treeProps"
/>
</template>
setup部分
<script setup lang="ts">
const treeProps = ref({
disabled: (data: DataListType) => { // DataListType是datalist的interface類型 如果eslint不嚴(yán)格蜻韭,可以不使用
return data.xx < data.yy // 判斷條件
}
})
</script>