RemoteTreeSelect.vue
<template>
<el-select
size="small"
class="component remote-tree-select"
popper-class="component remote-tree-select dropdown-wrapper"
:placeholder="placeholder"
:loading="loading"
:value="localValue"
multiple
collapse-tags
filterable
:filter-method="searchFunc"
@visible-change="e => !e && searchFunc()"
@remove-tag="removeItem">
<el-option v-show="false" value=""></el-option>
<el-option
v-for="item in selectedOptions"
:key="item[defaultProps.key]"
:value="item[defaultProps.key]"
:label="item[defaultProps.label]"
v-show="false">
</el-option>
<el-tree
ref="treeEl"
lazy
:load="syncFunc"
show-checkbox
check-strictly
@check="selectNode"
:data="localOptions"
:props="defaultProps"
:node-key="defaultProps.key"
:default-checked-keys="localValue"
:render-content="renderTreeLabel">
</el-tree>
</el-select>
</template>
<script>
export default {
name: 'RemoteTreeSelect',
props: {
placeholder: {
type: String,
default: '请选择'
},
value: {
types: Object || String,
default: () => ({
})
},
props: {
type: Object,
default: () =>