在周和日视图中反应大日历错误 - 'iteratee is not a function'
React Big Calendar Error on Week and Day views - 'iteratee is not a function'
当我打开周视图或日视图时,如果事件不是全天(有一个范围,例如下午 1 点 - 3 点),我遇到了错误 - iterate is not a function
_baseOrderBy.js:24 Uncaught TypeError: iteratee is not a function
at _baseOrderBy.js:24
at arrayMap (_arrayMap.js:16)
at _baseOrderBy.js:23
at arrayMap (_baseMap.js:16)
at baseOrderBy (_baseOrderBy.js:22)
at sortBy.js:45
at apply (_apply.js:15)
at _overRest.js:32
at sortByRender (react-big-calendar.esm.js:2430)
at getStyledEvents (react-big-calendar.esm.js:2472)
有人可以帮助解决这个错误吗?
事件对象示例:
const [events, setEvents] = useState([]);
async function getEvents() {
const events = await api.getEvents();
const eventsList = evetns.map(item => ({
id: item.id,
label: item.label,
start: moment(item.start).toDate(),
end: moment(item.end).toDate(),
}));
setEvents(eventsList);
}
useEffect(() => {
getEvents();
}, []);
return (
<Calendar
events={events}
popup
onSelectSlot={(props) => selectSlot(props)}
/>
)
好的,问题出在 LodashModuleReplacementPlugin
。使用此插件 webpack 将 react-big-calendar 中的导入替换为 lodash
并导入错误的 lodash 函数(或类似的东西)。
当我打开周视图或日视图时,如果事件不是全天(有一个范围,例如下午 1 点 - 3 点),我遇到了错误 - iterate is not a function
_baseOrderBy.js:24 Uncaught TypeError: iteratee is not a function
at _baseOrderBy.js:24
at arrayMap (_arrayMap.js:16)
at _baseOrderBy.js:23
at arrayMap (_baseMap.js:16)
at baseOrderBy (_baseOrderBy.js:22)
at sortBy.js:45
at apply (_apply.js:15)
at _overRest.js:32
at sortByRender (react-big-calendar.esm.js:2430)
at getStyledEvents (react-big-calendar.esm.js:2472)
有人可以帮助解决这个错误吗?
事件对象示例:
const [events, setEvents] = useState([]);
async function getEvents() {
const events = await api.getEvents();
const eventsList = evetns.map(item => ({
id: item.id,
label: item.label,
start: moment(item.start).toDate(),
end: moment(item.end).toDate(),
}));
setEvents(eventsList);
}
useEffect(() => {
getEvents();
}, []);
return (
<Calendar
events={events}
popup
onSelectSlot={(props) => selectSlot(props)}
/>
)
好的,问题出在 LodashModuleReplacementPlugin
。使用此插件 webpack 将 react-big-calendar 中的导入替换为 lodash
并导入错误的 lodash 函数(或类似的东西)。