Closed yaya1286249672 closed 2 years ago
function getChildren(data) { var _ref = data || {}, props = _ref.props;
if (typeof props.children === 'string') return props.children; return props.children.reduce(function (prev, cur) { if (typeof prev === 'string') { return prev + ' ' + getChildren(cur); }
return getChildren(prev) + ' ' + getChildren(cur);
}, ''); }
给个问题复现的在线例子吧
比如render:(v)=>{ return
function getChildren(data) { var _ref = data || {}, props = _ref.props;
if (typeof props.children === 'string') return props.children; return props.children.reduce(function (prev, cur) { if (typeof prev === 'string') { return prev + ' ' + getChildren(cur); }
}, ''); }