症状就是,回显数据的时候,默认显示的id,应该显示对应的label才对,然后只要选择一下就正常了,以前也碰到过,无非就是传入的类型不对,或者回显时list数据没过来,排除这两点,查了好久还是不行有兄弟遇到过吗element tree-select文档
<template>
<el-tree-select
v-if="isShow"
v-model="value"
:data="data"
:teleported="false"
:props="props"
/>
</template>
<script setup>
import {
DeptQueryTreeList
} from '@/api/dept'
const props = {
label: 'name',
value: 'id'
}
const value = ref()
const data = ref()
const isShow = ref(false)
/* 获取组织树数据 */
function getDeptList () {
DeptQueryTreeList().then(res => {
data.value = res.data
isShow.value = true
})
}
getDeptList()
</script>
<style>
</style>