【发布时间】:2022-01-20 15:19:39
【问题描述】:
const isDisplayStaticAndConditionalSwitcher = (fieldNode, window) => {
const fieldDataSourceCode = fieldNode.getAttribute('DataSourceCode') || [];
const nodeValues = Object.values(window?.Designer?.nodes); // get the nodes values
const formDataSourceCode = nodeValues.map((o) => {
if (o.displayName === 'Form') { return o.props.code; }
}).filter((v) => v)[0];
return fieldDataSourceCode === formDataSourceCode;
};
我收到了错误,expected to return a value at the end of the arrow function error 我应该如何解决这个问题?
【问题讨论】:
-
这不是错误,而是 linter 警告。您是否阅读了您正在使用的 linting 规则的说明?
-
你可能想写
nodeValues.find(o => o.displayName === 'Form')?.props.code
标签: javascript ecmascript-6 arrow-functions