Commit 523e2c81fdea4df923238fe1650a09a1640aa037

Authored by Sergio Crisostomo
1 parent 88ef37f5

correct match logic for i-option and Option

Showing 1 changed file with 3 additions and 2 deletions   Show diff stats
src/components/select/select.vue
@@ -80,7 +80,8 @@ @@ -80,7 +80,8 @@
80 import FunctionalOptions from './functional-options.vue'; 80 import FunctionalOptions from './functional-options.vue';
81 81
82 const prefixCls = 'ivu-select'; 82 const prefixCls = 'ivu-select';
83 - const optionGroupRegexp = /option\-?group/i; 83 + const optionRegexp = /^i-option$|^Option$/;
  84 + const optionGroupRegexp = /option-?group/i;
84 85
85 const findChild = (instance, checkFn) => { 86 const findChild = (instance, checkFn) => {
86 let match = checkFn(instance); 87 let match = checkFn(instance);
@@ -94,7 +95,7 @@ @@ -94,7 +95,7 @@
94 95
95 const findOptionsInVNode = (node) => { 96 const findOptionsInVNode = (node) => {
96 const opts = node.componentOptions; 97 const opts = node.componentOptions;
97 - if (opts && opts.tag === 'Option') return [node]; 98 + if (opts && opts.tag.match(optionRegexp)) return [node];
98 if (!node.children) return []; 99 if (!node.children) return [];
99 const options = node.children.reduce( 100 const options = node.children.reduce(
100 (arr, el) => [...arr, ...findOptionsInVNode(el)], [] 101 (arr, el) => [...arr, ...findOptionsInVNode(el)], []