Commit 7d14e70c6e329114b6c5efd4068030db2a46e709

Authored by Sergio Crisostomo
1 parent aa21cdf9

Include both node and componentOptions children in lookup

Showing 1 changed file with 3 additions and 2 deletions   Show diff stats
src/components/select/select.vue
... ... @@ -96,8 +96,9 @@
96 96 const findOptionsInVNode = (node) => {
97 97 const opts = node.componentOptions;
98 98 if (opts && opts.tag.match(optionRegexp)) return [node];
99   - if (!node.children) return [];
100   - const options = node.children.reduce(
  99 + if (!node.children && (!opts || !opts.children)) return [];
  100 + const children = [...(node.children || []), ...(opts && opts.children || [])];
  101 + const options = children.reduce(
101 102 (arr, el) => [...arr, ...findOptionsInVNode(el)], []
102 103 ).filter(Boolean);
103 104 return options.length > 0 ? options : [];
... ...