Include both node and componentOptions children in lookup

This commit is contained in:
Sergio Crisostomo 2018-05-03 11:36:34 +02:00
parent aa21cdf9c3
commit 7d14e70c6e

View file

@ -96,8 +96,9 @@
const findOptionsInVNode = (node) => {
const opts = node.componentOptions;
if (opts && opts.tag.match(optionRegexp)) return [node];
if (!node.children) return [];
const options = node.children.reduce(
if (!node.children && (!opts || !opts.children)) return [];
const children = [...(node.children || []), ...(opts && opts.children || [])];
const options = children.reduce(
(arr, el) => [...arr, ...findOptionsInVNode(el)], []
).filter(Boolean);
return options.length > 0 ? options : [];