Commit 11bfd555 authored by junyiz's avatar junyiz Committed by iamkun

Cascader: fix display errors (#15935)

parent 9617e934
import Node from './node'; import Node from './node';
import { coerceTruthyValueToArray } from 'element-ui/src/utils/util'; import { coerceTruthyValueToArray, valueEquals } from 'element-ui/src/utils/util';
const flatNodes = (data, leafOnly) => { const flatNodes = (data, leafOnly) => {
return data.reduce((res, node) => { return data.reduce((res, node) => {
...@@ -52,9 +52,8 @@ export default class Store { ...@@ -52,9 +52,8 @@ export default class Store {
getNodeByValue(value) { getNodeByValue(value) {
if (value) { if (value) {
value = Array.isArray(value) ? value[value.length - 1] : value;
const nodes = this.getFlattedNodes(false, !this.config.lazy) const nodes = this.getFlattedNodes(false, !this.config.lazy)
.filter(node => node.value === value); .filter(node => (valueEquals(node.path, value) || node.value === value));
return nodes && nodes.length ? nodes[0] : null; return nodes && nodes.length ? nodes[0] : null;
} }
return null; return null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment