correct match logic for i-option and Option
This commit is contained in:
parent
88ef37f5bb
commit
523e2c81fd
1 changed files with 3 additions and 2 deletions
|
@ -80,7 +80,8 @@
|
||||||
import FunctionalOptions from './functional-options.vue';
|
import FunctionalOptions from './functional-options.vue';
|
||||||
|
|
||||||
const prefixCls = 'ivu-select';
|
const prefixCls = 'ivu-select';
|
||||||
const optionGroupRegexp = /option\-?group/i;
|
const optionRegexp = /^i-option$|^Option$/;
|
||||||
|
const optionGroupRegexp = /option-?group/i;
|
||||||
|
|
||||||
const findChild = (instance, checkFn) => {
|
const findChild = (instance, checkFn) => {
|
||||||
let match = checkFn(instance);
|
let match = checkFn(instance);
|
||||||
|
@ -94,7 +95,7 @@
|
||||||
|
|
||||||
const findOptionsInVNode = (node) => {
|
const findOptionsInVNode = (node) => {
|
||||||
const opts = node.componentOptions;
|
const opts = node.componentOptions;
|
||||||
if (opts && opts.tag === 'Option') return [node];
|
if (opts && opts.tag.match(optionRegexp)) return [node];
|
||||||
if (!node.children) return [];
|
if (!node.children) return [];
|
||||||
const options = node.children.reduce(
|
const options = node.children.reduce(
|
||||||
(arr, el) => [...arr, ...findOptionsInVNode(el)], []
|
(arr, el) => [...arr, ...findOptionsInVNode(el)], []
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue