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 80 import FunctionalOptions from './functional-options.vue';
81 81  
82 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 86 const findChild = (instance, checkFn) => {
86 87 let match = checkFn(instance);
... ... @@ -94,7 +95,7 @@
94 95  
95 96 const findOptionsInVNode = (node) => {
96 97 const opts = node.componentOptions;
97   - if (opts && opts.tag === 'Option') return [node];
  98 + if (opts && opts.tag.match(optionRegexp)) return [node];
98 99 if (!node.children) return [];
99 100 const options = node.children.reduce(
100 101 (arr, el) => [...arr, ...findOptionsInVNode(el)], []
... ...