docs: 🐞change the default setting of "treeNodeFilterProp" from "va… (#6610)
* docs: 📃change the default setting of "treeNodeFilterProp" from "value" to "label"
* revert: ↩revert this config and create another pr to commit
pull/6657/head
parent
80edf86d18
commit
8212237045
|
@ -26,10 +26,11 @@ The most basic usage.
|
||||||
allow-clear
|
allow-clear
|
||||||
tree-default-expand-all
|
tree-default-expand-all
|
||||||
:tree-data="treeData"
|
:tree-data="treeData"
|
||||||
|
tree-node-filter-prop="label"
|
||||||
>
|
>
|
||||||
<template #title="{ value: val, title }">
|
<template #title="{ value: val, label }">
|
||||||
<b v-if="val === 'parent 1-1'" style="color: #08c">sss</b>
|
<b v-if="val === 'parent 1-1'" style="color: #08c">sss</b>
|
||||||
<template v-else>{{ title }}</template>
|
<template v-else>{{ label }}</template>
|
||||||
</template>
|
</template>
|
||||||
</a-tree-select>
|
</a-tree-select>
|
||||||
</template>
|
</template>
|
||||||
|
@ -41,25 +42,25 @@ export default defineComponent({
|
||||||
const value = ref<string>();
|
const value = ref<string>();
|
||||||
const treeData = ref<TreeSelectProps['treeData']>([
|
const treeData = ref<TreeSelectProps['treeData']>([
|
||||||
{
|
{
|
||||||
title: 'parent 1',
|
label: 'parent 1',
|
||||||
value: 'parent 1',
|
value: 'parent 1',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
title: 'parent 1-0',
|
label: 'parent 1-0',
|
||||||
value: 'parent 1-0',
|
value: 'parent 1-0',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
title: 'my leaf',
|
label: 'my leaf',
|
||||||
value: 'leaf1',
|
value: 'leaf1',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'your leaf',
|
label: 'your leaf',
|
||||||
value: 'leaf2',
|
value: 'leaf2',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'parent 1-1',
|
label: 'parent 1-1',
|
||||||
value: 'parent 1-1',
|
value: 'parent 1-1',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -24,6 +24,7 @@ Multiple and checkable.
|
||||||
allow-clear
|
allow-clear
|
||||||
:show-checked-strategy="SHOW_PARENT"
|
:show-checked-strategy="SHOW_PARENT"
|
||||||
placeholder="Please select"
|
placeholder="Please select"
|
||||||
|
tree-node-filter-prop="label"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -34,31 +35,31 @@ const SHOW_PARENT = TreeSelect.SHOW_PARENT;
|
||||||
|
|
||||||
const treeData: TreeSelectProps['treeData'] = [
|
const treeData: TreeSelectProps['treeData'] = [
|
||||||
{
|
{
|
||||||
title: 'Node1',
|
label: 'Node1',
|
||||||
value: '0-0',
|
value: '0-0',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
title: 'Child Node1',
|
label: 'Child Node1',
|
||||||
value: '0-0-0',
|
value: '0-0-0',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Node2',
|
label: 'Node2',
|
||||||
value: '0-1',
|
value: '0-1',
|
||||||
|
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
title: 'Child Node3',
|
label: 'Child Node3',
|
||||||
value: '0-1-0',
|
value: '0-1-0',
|
||||||
disabled: true,
|
disabled: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Child Node4',
|
label: 'Child Node4',
|
||||||
value: '0-1-1',
|
value: '0-1-1',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Child Node5',
|
label: 'Child Node5',
|
||||||
value: '0-1-2',
|
value: '0-1-2',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -28,15 +28,16 @@ Allows for custom rendering of tags.
|
||||||
:show-checked-strategy="SHOW_ALL"
|
:show-checked-strategy="SHOW_ALL"
|
||||||
tree-default-expand-all
|
tree-default-expand-all
|
||||||
:tree-data="treeData"
|
:tree-data="treeData"
|
||||||
|
tree-node-filter-prop="label"
|
||||||
>
|
>
|
||||||
<template #tagRender="{ label, closable, onClose, option }">
|
<template #tagRender="{ label, closable, onClose, option }">
|
||||||
<a-tag :closable="closable" :color="option.color" style="margin-right: 3px" @close="onClose">
|
<a-tag :closable="closable" :color="option.color" style="margin-right: 3px" @close="onClose">
|
||||||
{{ label }}
|
{{ label }}
|
||||||
</a-tag>
|
</a-tag>
|
||||||
</template>
|
</template>
|
||||||
<template #title="{ value: val, title }">
|
<template #title="{ value: val, label }">
|
||||||
<b v-if="val === 'parent 1-1'" style="color: #08c">{{ val }}</b>
|
<b v-if="val === 'parent 1-1'" style="color: #08c">{{ val }}</b>
|
||||||
<template v-else>{{ title }}</template>
|
<template v-else>{{ label }}</template>
|
||||||
</template>
|
</template>
|
||||||
</a-tree-select>
|
</a-tree-select>
|
||||||
</template>
|
</template>
|
||||||
|
@ -50,29 +51,29 @@ export default defineComponent({
|
||||||
const value = ref<string[]>(['parent 1', 'parent 1-0', 'leaf1']);
|
const value = ref<string[]>(['parent 1', 'parent 1-0', 'leaf1']);
|
||||||
const treeData = ref<TreeSelectProps['treeData']>([
|
const treeData = ref<TreeSelectProps['treeData']>([
|
||||||
{
|
{
|
||||||
title: 'parent 1',
|
label: 'parent 1',
|
||||||
value: 'parent 1',
|
value: 'parent 1',
|
||||||
color: 'pink',
|
color: 'pink',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
title: 'parent 1-0',
|
label: 'parent 1-0',
|
||||||
value: 'parent 1-0',
|
value: 'parent 1-0',
|
||||||
color: 'orange',
|
color: 'orange',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
title: 'my leaf',
|
label: 'my leaf',
|
||||||
value: 'leaf1',
|
value: 'leaf1',
|
||||||
color: 'green',
|
color: 'green',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'your leaf',
|
label: 'your leaf',
|
||||||
value: 'leaf2',
|
value: 'leaf2',
|
||||||
color: 'cyan',
|
color: 'cyan',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'parent 1-1',
|
label: 'parent 1-1',
|
||||||
value: 'parent 1-1',
|
value: 'parent 1-1',
|
||||||
color: 'blue',
|
color: 'blue',
|
||||||
},
|
},
|
||||||
|
|
|
@ -27,12 +27,13 @@ Search Value Hightlight
|
||||||
allow-clear
|
allow-clear
|
||||||
tree-default-expand-all
|
tree-default-expand-all
|
||||||
:tree-data="treeData"
|
:tree-data="treeData"
|
||||||
|
tree-node-filter-prop="label"
|
||||||
>
|
>
|
||||||
<template #title="{ value: val, title }">
|
<template #title="{ value: val, label }">
|
||||||
<b v-if="val === 'parent 1-1'" style="color: #08c">sss</b>
|
<b v-if="val === 'parent 1-1'" style="color: #08c">sss</b>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<template
|
<template
|
||||||
v-for="(fragment, i) in title
|
v-for="(fragment, i) in label
|
||||||
.toString()
|
.toString()
|
||||||
.split(new RegExp(`(?<=${searchValue})|(?=${searchValue})`, 'i'))"
|
.split(new RegExp(`(?<=${searchValue})|(?=${searchValue})`, 'i'))"
|
||||||
>
|
>
|
||||||
|
@ -57,25 +58,25 @@ export default defineComponent({
|
||||||
const value = ref<string>();
|
const value = ref<string>();
|
||||||
const treeData = ref<TreeSelectProps['treeData']>([
|
const treeData = ref<TreeSelectProps['treeData']>([
|
||||||
{
|
{
|
||||||
title: 'parent 1',
|
label: 'parent 1',
|
||||||
value: 'parent 1',
|
value: 'parent 1',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
title: 'parent 1-0',
|
label: 'parent 1-0',
|
||||||
value: 'parent 1-0',
|
value: 'parent 1-0',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
title: 'my leaf',
|
label: 'my leaf',
|
||||||
value: 'leaf1',
|
value: 'leaf1',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'your leaf',
|
label: 'your leaf',
|
||||||
value: 'leaf2',
|
value: 'leaf2',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'parent 1-1',
|
label: 'parent 1-1',
|
||||||
value: 'parent 1-1',
|
value: 'parent 1-1',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -27,10 +27,11 @@ Multiple selection usage.
|
||||||
multiple
|
multiple
|
||||||
tree-default-expand-all
|
tree-default-expand-all
|
||||||
:tree-data="treeData"
|
:tree-data="treeData"
|
||||||
|
tree-node-filter-prop="label"
|
||||||
>
|
>
|
||||||
<template #title="{ value: val, title }">
|
<template #title="{ value: val, label }">
|
||||||
<b v-if="val === 'parent 1-1'" style="color: #08c">{{ val }}</b>
|
<b v-if="val === 'parent 1-1'" style="color: #08c">{{ val }}</b>
|
||||||
<template v-else>{{ title }}</template>
|
<template v-else>{{ label }}</template>
|
||||||
</template>
|
</template>
|
||||||
</a-tree-select>
|
</a-tree-select>
|
||||||
</template>
|
</template>
|
||||||
|
@ -43,25 +44,25 @@ export default defineComponent({
|
||||||
const value = ref<string[]>([]);
|
const value = ref<string[]>([]);
|
||||||
const treeData = ref<TreeSelectProps['treeData']>([
|
const treeData = ref<TreeSelectProps['treeData']>([
|
||||||
{
|
{
|
||||||
title: 'parent 1',
|
label: 'parent 1',
|
||||||
value: 'parent 1',
|
value: 'parent 1',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
title: 'parent 1-0',
|
label: 'parent 1-0',
|
||||||
value: 'parent 1-0',
|
value: 'parent 1-0',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
title: 'my leaf',
|
label: 'my leaf',
|
||||||
value: 'leaf1',
|
value: 'leaf1',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'your leaf',
|
label: 'your leaf',
|
||||||
value: 'leaf2',
|
value: 'leaf2',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'parent 1-1',
|
label: 'parent 1-1',
|
||||||
value: 'parent 1-1',
|
value: 'parent 1-1',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -31,6 +31,7 @@ Replace the title,key and children fields in treeNode with the corresponding fie
|
||||||
label: 'name',
|
label: 'name',
|
||||||
value: 'value',
|
value: 'value',
|
||||||
}"
|
}"
|
||||||
|
tree-node-filter-prop="name"
|
||||||
></a-tree-select>
|
></a-tree-select>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|
|
@ -27,6 +27,12 @@ The most basic usage.
|
||||||
allow-clear
|
allow-clear
|
||||||
tree-default-expand-all
|
tree-default-expand-all
|
||||||
:tree-data="treeData"
|
:tree-data="treeData"
|
||||||
|
:field-names="{
|
||||||
|
children: 'children',
|
||||||
|
value: 'value',
|
||||||
|
label: 'title',
|
||||||
|
}"
|
||||||
|
tree-node-filter-prop="title"
|
||||||
>
|
>
|
||||||
<template #suffixIcon><SmileOutlined /></template>
|
<template #suffixIcon><SmileOutlined /></template>
|
||||||
</a-tree-select>
|
</a-tree-select>
|
||||||
|
@ -42,6 +48,12 @@ The most basic usage.
|
||||||
show-arrow
|
show-arrow
|
||||||
tree-default-expand-all
|
tree-default-expand-all
|
||||||
:tree-data="treeData"
|
:tree-data="treeData"
|
||||||
|
:field-names="{
|
||||||
|
children: 'children',
|
||||||
|
value: 'value',
|
||||||
|
label: 'title',
|
||||||
|
}"
|
||||||
|
tree-node-filter-prop="title"
|
||||||
>
|
>
|
||||||
<template #suffixIcon><SmileOutlined /></template>
|
<template #suffixIcon><SmileOutlined /></template>
|
||||||
</a-tree-select>
|
</a-tree-select>
|
||||||
|
|
Loading…
Reference in New Issue